Package org.apache.cassandra.io.util
Class NIODataInputStream
java.lang.Object
java.io.InputStream
org.apache.cassandra.io.util.DataInputPlus.DataInputStreamPlus
org.apache.cassandra.io.util.RebufferingInputStream
org.apache.cassandra.io.util.NIODataInputStream
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable,DataInputPlus
Rough equivalent of BufferedInputStream and DataInputStream wrapping the input stream of a File or Socket
Created to work around the fact that when BIS + DIS delegate to NIO for socket IO they will allocate large
thread local direct byte buffers when a large array is used to read.
There may also be some performance improvement due to using a DBB as the underlying buffer for IO and the removal
of some indirection and delegation when it comes to reading out individual values, but that is not the goal.
Closing NIODataInputStream will invoke close on the ReadableByteChannel provided at construction.
NIODataInputStream is not thread safe.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.cassandra.io.util.DataInputPlus
DataInputPlus.DataInputStreamPlus -
Field Summary
FieldsFields inherited from class org.apache.cassandra.io.util.RebufferingInputStream
buffer -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.cassandra.io.util.RebufferingInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readFully, readInt, readLine, readLong, readPrimitiveSlowly, readShort, readUnsignedByte, readUnsignedShort, readUnsignedVInt, readUnsignedVInt32, readUTF, readVInt, readVInt32, skipBytesMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferToMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.io.util.DataInputPlus
skipBytesFully
-
Field Details
-
channel
-
-
Constructor Details
-
NIODataInputStream
-
-
Method Details
-
reBuffer
Description copied from class:RebufferingInputStreamImplementations must implement this method to refill the buffer. They can expect the buffer to be empty when this method is invoked.- Specified by:
reBufferin classRebufferingInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-