Package org.apache.hadoop.fs.store
Class ByteBufferInputStream
java.lang.Object
java.io.InputStream
org.apache.hadoop.fs.store.ByteBufferInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Provide an input stream from a byte buffer; supporting
mark(int).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()After the stream is closed, set the local reference to the byte buffer to null; this guarantees that future attempts to use stream methods will fail.booleanCheck if there is data left.booleanisOpen()Is the stream open?voidmark(int readlimit) booleanintposition()Get the current buffer position.intread()intread(byte[] b, int offset, int length) Read in data.voidreset()longskip(long offset) toString()Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
ByteBufferInputStream
-
-
Method Details
-
close
public void close()After the stream is closed, set the local reference to the byte buffer to null; this guarantees that future attempts to use stream methods will fail.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-
isOpen
public boolean isOpen()Is the stream open?- Returns:
- true if the stream has not been closed.
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
public int available()- Overrides:
availablein classInputStream
-
position
public int position()Get the current buffer position.- Returns:
- the buffer position
-
hasRemaining
public boolean hasRemaining()Check if there is data left.- Returns:
- true if there is data remaining in the buffer.
-
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
read
Read in data.- Overrides:
readin classInputStream- Parameters:
b- destination buffer.offset- offset within the buffer.length- length of bytes to read.- Throws:
EOFException- if the position is negativeIndexOutOfBoundsException- if there isn't space for the amount of data requested.IllegalArgumentException- other arguments are invalid.IOException
-
toString
-