Package org.apache.iceberg.io
Class IOUtil
java.lang.Object
org.apache.iceberg.io.IOUtil
- 
Method SummaryModifier and TypeMethodDescriptionstatic intcapacityFor(int size) Returns a capacity that is the next power of 2 larger than the size.static voidreadFully(InputStream stream, byte[] bytes, int offset, int length) Reads into a buffer from a stream, making multiple read calls if necessary.static intreadRemaining(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(OutputStream outputStream, ByteBuffer buffer) Writes a buffer into a stream, making multiple write calls if necessary.
- 
Method Details- 
readFullypublic static void readFully(InputStream stream, byte[] bytes, int offset, int length) throws IOException Reads into a buffer from a stream, making multiple read calls if necessary.- Parameters:
- stream- an InputStream to read from
- bytes- a buffer to write into
- offset- starting offset in the buffer for the data
- length- length of bytes to copy from the input stream to the buffer
- Throws:
- EOFException- if the end of the stream is reached before reading length bytes
- IOException- if there is an error while reading
 
- 
writeFullyWrites a buffer into a stream, making multiple write calls if necessary.- Throws:
- IOException
 
- 
readRemainingpublic static int readRemaining(InputStream stream, byte[] bytes, int offset, int length) throws IOException Reads 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 from
- bytes- a buffer to write into
- offset- starting offset in the buffer for the data
- length- length of bytes to copy from the input stream to the buffer
- Returns:
- the number of bytes read
- Throws:
- IOException- if there is an error while reading
 
- 
capacityForpublic static int capacityFor(int size) Returns a capacity that is the next power of 2 larger than the size.- Parameters:
- size- an object size
- Returns:
- a capacity that is larger than the size for reused buffers
 
 
-