Package io.deephaven.io.streams
Class ByteBufferInputStream
java.lang.Object
java.io.InputStream
io.deephaven.io.streams.ByteBufferInputStream
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable
This is an InputStream implementation which reads from a java.nio.ByteBuffer. If a read operation crosses the end of
the buffer, the BufferUnderflowException is converted to an EOFException.
The stream contains no state other than that in in the buffer itself, so the buffer can be exchanged at will with the
setBuffer() method.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new stream which reads from a byte buffer/ -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()voidmark(int readlimit) booleanintread()intread(byte[] b) intread(byte[] b, int off, int len) voidread(ByteBuffer dest, int length) booleanbytereadByte()charreadChar()doublefloatvoidreadFully(byte[] b) voidreadFully(byte[] b, int off, int len) intreadInt()readLine()longreadLong()shortintintreadUTF()voidreadUTF(@NotNull io.deephaven.base.string.cache.CharSequenceAdapterBuilder output) readUTF(@NotNull io.deephaven.base.string.cache.CharSequenceAdapterBuilder output, @NotNull io.deephaven.base.string.cache.StringCache<String> cache) voidreset()voidsetBuffer(ByteBuffer buf) Set the buffer to be used for future read operations.longskip(long n) intskipBytes(int n) Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
buf
the buffer from which we read
-
-
Constructor Details
-
ByteBufferInputStream
Construct a new stream which reads from a byte buffer/
-
-
Method Details
-
setBuffer
Set the buffer to be used for future read operations. -
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
skipBytes
- Specified by:
skipBytesin interfaceDataInput- Throws:
IOException
-
readBoolean
- Specified by:
readBooleanin interfaceDataInput- Throws:
IOException
-
readByte
- Specified by:
readBytein interfaceDataInput- Throws:
IOException
-
readUnsignedByte
- Specified by:
readUnsignedBytein interfaceDataInput- Throws:
IOException
-
readShort
- Specified by:
readShortin interfaceDataInput- Throws:
IOException
-
readUnsignedShort
- Specified by:
readUnsignedShortin interfaceDataInput- Throws:
IOException
-
readChar
- Specified by:
readCharin interfaceDataInput- Throws:
IOException
-
readInt
- Specified by:
readIntin interfaceDataInput- Throws:
IOException
-
readLong
- Specified by:
readLongin interfaceDataInput- Throws:
IOException
-
readFloat
- Specified by:
readFloatin interfaceDataInput- Throws:
IOException
-
readDouble
- Specified by:
readDoublein interfaceDataInput- Throws:
IOException
-
readLine
- Specified by:
readLinein interfaceDataInput- Throws:
IOException
-
readUTF
- Specified by:
readUTFin interfaceDataInput- Throws:
IOException
-
readUTF
public String readUTF(@NotNull @NotNull io.deephaven.base.string.cache.CharSequenceAdapterBuilder output, @NotNull @NotNull io.deephaven.base.string.cache.StringCache<String> cache) throws IOException - Throws:
IOException
-
readUTF
public void readUTF(@NotNull @NotNull io.deephaven.base.string.cache.CharSequenceAdapterBuilder output) throws IOException - Throws:
IOException
-
read
-