|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
org.blinkenbyte.io.ByteArrayBuffer.ByteArrayBufferInputStream
public static class ByteArrayBuffer.ByteArrayBufferInputStream
Class that can extends InputStream and can read directly from the internal buffers of the host ByteArrayBuffer. This prevents unnecessary duplication of data, and a way of using the buffer as a device that can be read and written from.
| Field Summary | |
|---|---|
protected ByteArrayBuffer |
bab
The ByteArrayBufffer this InputStream reads from. |
protected int |
markPtr
The mark pointer. |
protected int |
markReadLimit
The mark read limit. |
protected int |
readPtr
The read pointer used by this input stream. |
protected boolean |
sharedPointer
Whether this input stream should share a pointer with the host ByteArrayBuffer. |
protected int |
SUB_BUFFER_LOG
Copy of SUB_BUFFER_LOG from the host ByteArrayBuffer. |
protected int |
SUB_BUFFER_MASK
Copy of SUB_BUFFER_MASK from the host ByteArrayBuffer. |
protected int |
SUB_BUFFER_SIZE
Copy of SUB_BUFFER_SIZE from the host ByteArrayBuffer. |
| Constructor Summary | |
|---|---|
ByteArrayBuffer.ByteArrayBufferInputStream(ByteArrayBuffer _bab)
Constructs a new ByteArrayBufferInputStream from an existing ByteArrayBuffer |
|
ByteArrayBuffer.ByteArrayBufferInputStream(ByteArrayBuffer _bab,
boolean _sharedPointer)
Constructs a new ByteArrayBufferInputStream from an existing ByteArrayBuffer and specifies whether they should share a read/write pointer. |
|
| Method Summary | |
|---|---|
int |
available()
Returns the number of bytes available to be read. |
void |
close()
Closes this stream (nulls the reference to the ByteArrayBuffer). |
void |
mark(int readLimit)
Sets the limit for mark(). |
boolean |
markSupported()
Returns true. |
int |
read()
Reads a single byte. |
int |
read(byte[] b)
Reads up to b.length bytes into b. |
int |
read(byte[] b,
int offset,
int len)
Reads up to offset bytes into array b starting at b[offset]. |
void |
reset()
Resets the read pointer back to the mark. |
int |
seek(int newReadPtr)
Seeks the pointer to newReadPtr. |
long |
skip(long n)
Advances the pointer n bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ByteArrayBuffer bab
protected int readPtr
protected int markPtr
protected int markReadLimit
protected int SUB_BUFFER_LOG
protected int SUB_BUFFER_SIZE
protected int SUB_BUFFER_MASK
protected boolean sharedPointer
| Constructor Detail |
|---|
public ByteArrayBuffer.ByteArrayBufferInputStream(ByteArrayBuffer _bab)
public ByteArrayBuffer.ByteArrayBufferInputStream(ByteArrayBuffer _bab,
boolean _sharedPointer)
| Method Detail |
|---|
public int available()
available in class java.io.InputStreampublic void close()
close in interface java.io.Closeableclose in class java.io.InputStreampublic void mark(int readLimit)
mark in class java.io.InputStreampublic boolean markSupported()
markSupported in class java.io.InputStreampublic int read()
read in class java.io.InputStreampublic int read(byte[] b)
read in class java.io.InputStream
public int read(byte[] b,
int offset,
int len)
read in class java.io.InputStream
public void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long n)
skip in class java.io.InputStreampublic int seek(int newReadPtr)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||