|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
com.lowagie.text.rtf.document.output.RtfByteArrayBuffer
public final class RtfByteArrayBuffer
A RtfByteArrayBuffer works much like ByteArrayOutputStream but is cheaper and faster in most cases
(exception: large writes when reusing buffers).
| Field Summary | |
|---|---|
private List |
arrays
|
private byte[] |
buffer
|
private int |
pos
|
private int |
size
|
| Constructor Summary | |
|---|---|
RtfByteArrayBuffer()
Constructs a new buffer with a default initial size of 128 bytes. |
|
RtfByteArrayBuffer(int bufferSize)
Creates a new buffer with the given initial size. |
|
| Method Summary | |
|---|---|
void |
append(byte[] a)
Appends the given array to this buffer without copying (if possible). |
void |
append(byte[][] a)
Appends all arrays to this buffer without copying (if possible). |
private void |
flushBuffer()
|
private void |
flushBuffer(int reqSize)
|
void |
reset()
Resets this buffer. |
long |
size()
Returns the number of bytes that have been written to this buffer so far. |
byte[] |
toByteArray()
Allocates a new array and copies all data that has been written to this buffer to the newly allocated array. |
byte[][] |
toByteArrayArray()
Returns the internal list of byte array buffers without copying the buffer contents. |
String |
toString()
|
void |
write(byte[] src)
Copies the given array to the internal buffer. |
void |
write(byte[] src,
int off,
int len)
Copies len bytes starting at position off from the array src to the internal buffer. |
long |
write(InputStream in)
Writes all bytes available in the given inputstream to this buffer. |
void |
write(int b)
Copies the given byte to the internal buffer. |
private void |
writeLoop(byte[] src,
int off,
int len)
|
void |
writeTo(OutputStream out)
Writes all data that has been written to this buffer to the given output stream. |
| Methods inherited from class java.io.OutputStream |
|---|
close, flush |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private final List arrays
private byte[] buffer
private int pos
private int size
| Constructor Detail |
|---|
public RtfByteArrayBuffer()
public RtfByteArrayBuffer(int bufferSize)
bufferSize - desired initial size in bytes| Method Detail |
|---|
public String toString()
toString in class Objectpublic void reset()
public long size()
private void flushBuffer()
private void flushBuffer(int reqSize)
public void write(int b)
write in class OutputStreamb - public void write(byte[] src)
write in class OutputStreamsrc -
public void write(byte[] src,
int off,
int len)
write in class OutputStreamsrc - off - len -
private void writeLoop(byte[] src,
int off,
int len)
public long write(InputStream in)
throws IOException
in -
IOExceptionpublic void append(byte[] a)
a - public void append(byte[][] a)
a - public byte[][] toByteArrayArray()
public byte[] toByteArray()
public void writeTo(OutputStream out)
throws IOException
out -
IOException
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||