Package org.apache.iceberg.io
Class IOUtil
- java.lang.Object
-
- org.apache.iceberg.io.IOUtil
-
public class IOUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidreadFully(java.io.InputStream stream, byte[] bytes, int offset, int length)Reads into a buffer from a stream, making multiple read calls if necessary.static intreadRemaining(java.io.InputStream stream, byte[] bytes, int offset, int length)Reads into a buffer from a stream, making multiple read calls if necessary returning the number of bytes read until end of stream.static voidwriteFully(java.io.OutputStream outputStream, java.nio.ByteBuffer buffer)Writes a buffer into a stream, making multiple write calls if necessary.
-
-
-
Method Detail
-
readFully
public static void readFully(java.io.InputStream stream, byte[] bytes, int offset, int length) throws java.io.IOExceptionReads into a buffer from a stream, making multiple read calls if necessary.- Parameters:
stream- an InputStream to read frombytes- a buffer to write intooffset- starting offset in the buffer for the datalength- length of bytes to copy from the input stream to the buffer- Throws:
java.io.EOFException- if the end of the stream is reached before reading length bytesjava.io.IOException- if there is an error while reading
-
writeFully
public static void writeFully(java.io.OutputStream outputStream, java.nio.ByteBuffer buffer) throws java.io.IOExceptionWrites a buffer into a stream, making multiple write calls if necessary.- Throws:
java.io.IOException
-
readRemaining
public static int readRemaining(java.io.InputStream stream, byte[] bytes, int offset, int length) throws java.io.IOExceptionReads into a buffer from a stream, making multiple read calls if necessary returning the number of bytes read until end of stream.- Parameters:
stream- an InputStream to read frombytes- a buffer to write intooffset- starting offset in the buffer for the datalength- length of bytes to copy from the input stream to the buffer- Returns:
- the number of bytes read
- Throws:
java.io.IOException- if there is an error while reading
-
-