|
Copyright 2011-01-06 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
java.io.ByteArrayOutputStream
ch.randelshofer.io.SeekableByteArrayOutputStream
public class SeekableByteArrayOutputStream
SeekableByteArrayOutputStream.
| Field Summary |
|---|
| Fields inherited from class java.io.ByteArrayOutputStream |
|---|
buf, count |
| Constructor Summary | |
|---|---|
SeekableByteArrayOutputStream()
Creates a new byte array output stream. |
|
SeekableByteArrayOutputStream(int size)
Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes. |
|
| Method Summary | |
|---|---|
long |
getStreamPosition()
Returns the current byte position of the stream. |
void |
reset()
Resets the count field of this byte array output
stream to zero, so that all currently accumulated output in the
output stream is discarded. |
void |
seek(long pos)
Sets the current stream position to the desired location. |
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array
starting at offset off to this byte array output stream. |
void |
write(int b)
Writes the specified byte to this byte array output stream. |
| Methods inherited from class java.io.ByteArrayOutputStream |
|---|
close, size, toByteArray, toString, toString, toString, writeTo |
| Methods inherited from class java.io.OutputStream |
|---|
flush, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SeekableByteArrayOutputStream()
public SeekableByteArrayOutputStream(int size)
size - the initial size.
java.lang.IllegalArgumentException - if size is negative.| Method Detail |
|---|
public void write(int b)
write in class java.io.ByteArrayOutputStreamb - the byte to be written.
public void write(byte[] b,
int off,
int len)
len bytes from the specified byte array
starting at offset off to this byte array output stream.
write in class java.io.ByteArrayOutputStreamb - the data.off - the start offset in the data.len - the number of bytes to write.public void reset()
count field of this byte array output
stream to zero, so that all currently accumulated output in the
output stream is discarded. The output stream can be used again,
reusing the already allocated buffer space.
reset in class java.io.ByteArrayOutputStreamByteArrayInputStream.count
public void seek(long pos)
throws java.io.IOException
An IndexOutOfBoundsException will be thrown if
pos is smaller than the flushed position (as
returned by getflushedPosition).
It is legal to seek past the end of the file; an
EOFException will be thrown only if a read is
performed.
pos - a long containing the desired file
pointer position.
java.lang.IndexOutOfBoundsException - if pos is smaller
than the flushed position.
java.io.IOException - if any other I/O error occurs.
public long getStreamPosition()
throws java.io.IOException
java.io.IOException - if an I/O error occurs.
|
Copyright 2011-01-06 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||