|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--juju.reattore.io.impl.ByteSourceSink
Buffer that may be used for temporary storage and which is backed by a byte array. Used for storing an incomming stream for later use. Concurrent read/write access is unpredictable. Concurrent read access shares the same stream position and marks.
Field Summary |
Fields inherited from interface juju.reattore.io.Source |
EOF |
Constructor Summary | |
ByteSourceSink()
Creates a new, empty source/sink |
|
ByteSourceSink(byte[] initial)
Creates a new source/sink and populates it. |
Method Summary | |
byte[] |
array()
Returns the array backing this source/sink. |
void |
compact()
Compacts the backing buffer to comtain just the data. |
int |
compareTo(java.lang.Object ob)
Compares this stream to a byte array. |
void |
dispose()
Called when the user is finished with this source. |
int |
get()
Gets the next byte from the stream. |
int |
get(byte[] into,
int offset,
int length)
Bulk get operation. |
void |
mark()
|
void |
put(byte[] from,
int offset,
int length)
Bulk put operation. |
void |
put(int toWrite)
Writes a byte to the stream. |
int |
remaining()
Returns the number of elements remaining in the stream. |
void |
reset()
|
void |
rewind()
|
int |
size()
Returns the number of elements in the stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ByteSourceSink()
public ByteSourceSink(byte[] initial)
initial
- Initial data to populate the source with.Method Detail |
public void mark()
Source
public void reset()
Source
public void rewind()
Source
public int get()
ByteSource
get
in interface ByteSource
ByteSource
public int get(byte[] into, int offset, int length)
ByteSource
get
in interface ByteSource
into
- The buffer to get into.offset
- The offset in the buffer to begin writing at.length
- The maximum number of elements to read.
ByteSource
public int remaining()
ByteSource
remaining
in interface ByteSource
ByteSource
public void put(int toWrite)
ByteSink
put
in interface ByteSink
toWrite
- The byte to write.ByteSink
public void put(byte[] from, int offset, int length)
ByteSink
put
in interface ByteSink
from
- The buffer to copy from.offset
- The offset in the buffer to begin reading from.length
- The number of elements to write.ByteSink
public int size()
ByteSink
size
in interface ByteSink
ByteSink
public void compact()
public byte[] array()
public int compareTo(java.lang.Object ob)
compareTo
in interface java.lang.Comparable
Object#compareTo
public void dispose()
Source
dispose
in interface Source
Source
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |