|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.blinkenbyte.io.ReadWriteByteArray
public class ReadWriteByteArray
This class implements a ReadWriteDevice using a ByteArrayBuffer as a backing store.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.blinkenbyte.io.ReadWriteDevice |
|---|
ReadWriteDevice.RWDInputStream, ReadWriteDevice.RWDOutputStream |
| Field Summary | |
|---|---|
protected ByteArrayBuffer |
bab
|
protected ByteArrayBuffer.ByteArrayBufferInputStream |
babInp
|
protected boolean |
isClosed
|
| Constructor Summary | |
|---|---|
ReadWriteByteArray()
|
|
ReadWriteByteArray(int initialSize)
Constructs a new ReadWriteByteArray with an initial size of initialSize bytes. |
|
| Method Summary | |
|---|---|
int |
available()
Returns the number of bytes between the current pointer and end-of-stream. |
void |
clear()
|
void |
close()
Closes the device. |
void |
flush()
Flushes the device. |
java.io.InputStream |
getInputStream()
Return an InputStream for reading from this device. |
java.io.OutputStream |
getOutputStream()
Return an OututStream for writing to this device. |
long |
getPointer()
Returns the current pointer for this device. |
long |
length()
Returns the total length in bytes of this device. |
void |
mark(long markLimit)
Sets the mark with the specified limit. |
boolean |
markSupported()
Returns whether mark is supported. |
int |
read()
Reads and returns a single byte. |
int |
read(byte[] b)
Reads up to b.length bytes from the device into array b. |
int |
read(byte[] b,
int offset,
int len)
Reads up to len bytes from the device into array b at b[offset]. |
void |
reset()
Resets the pointer to the mark position. |
void |
seek(long newPointer)
Seeks the pointer to the specified offset. |
void |
setLength(int newLength)
|
long |
skip(long amtToSkip)
Advances the pointer by the specified number of bytes |
protected void |
throwIfClosed()
|
void |
write(byte[] b)
Writes b.length bytes from array b to the device. |
void |
write(byte[] b,
int offset,
int len)
Writes len bytes from array b starting at b[offset] to the device. |
void |
write(int b)
Writes a single byte to the device. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ByteArrayBuffer bab
protected ByteArrayBuffer.ByteArrayBufferInputStream babInp
protected boolean isClosed
| Constructor Detail |
|---|
public ReadWriteByteArray()
public ReadWriteByteArray(int initialSize)
| Method Detail |
|---|
public void close()
throws java.io.IOException
ReadWriteDevice
close in interface java.io.Closeableclose in interface ReadWriteDevicejava.io.IOException
protected void throwIfClosed()
throws java.io.IOException
java.io.IOException
public void flush()
throws java.io.IOException
ReadWriteDevice
flush in interface ReadWriteDevicejava.io.IOException
public int available()
throws java.io.IOException
ReadWriteDevice
available in interface ReadWriteDevicejava.io.IOException
public long length()
throws java.io.IOException
ReadWriteDevice
length in interface ReadWriteDevicejava.io.IOException
public void setLength(int newLength)
throws java.io.IOException
java.io.IOException
public long getPointer()
throws java.io.IOException
ReadWriteDevice
getPointer in interface ReadWriteDevicejava.io.IOException
public void seek(long newPointer)
throws java.io.IOException
ReadWriteDevice
seek in interface ReadWriteDevicejava.io.IOException
public long skip(long amtToSkip)
throws java.io.IOException
ReadWriteDevice
skip in interface ReadWriteDevicejava.io.IOException
public int read()
throws java.io.IOException
ReadWriteDevice
read in interface ReadWriteDevicejava.io.IOException
public int read(byte[] b)
throws java.io.IOException
ReadWriteDevice
read in interface ReadWriteDevicejava.io.IOException
public int read(byte[] b,
int offset,
int len)
throws java.io.IOException
ReadWriteDevice
read in interface ReadWriteDevicejava.io.IOException
public void write(int b)
throws java.io.IOException
ReadWriteDevice
write in interface ReadWriteDevicejava.io.IOException
public void write(byte[] b)
throws java.io.IOException
ReadWriteDevice
write in interface ReadWriteDevicejava.io.IOException
public void write(byte[] b,
int offset,
int len)
throws java.io.IOException
ReadWriteDevice
write in interface ReadWriteDevicejava.io.IOException
public void mark(long markLimit)
throws java.io.IOException
ReadWriteDevice
mark in interface ReadWriteDevicejava.io.IOExceptionpublic boolean markSupported()
ReadWriteDevice
markSupported in interface ReadWriteDevice
public void reset()
throws java.io.IOException
ReadWriteDevice
reset in interface ReadWriteDevicejava.io.IOExceptionpublic void clear()
public java.io.InputStream getInputStream()
ReadWriteDevice
getInputStream in interface ReadWriteDevicepublic java.io.OutputStream getOutputStream()
ReadWriteDevice
getOutputStream in interface ReadWriteDevice
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||