Class ByteBuffer
java.lang.Object
java.io.OutputStream
com.aowagie.text.pdf.ByteBuffer
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Acts like a
StringBuffer but works with byte arrays.
Floating point is converted to a format suitable to the PDF.- Author:
- Paulo Soares (psoares@consiste.pt)
-
Constructor Summary
ConstructorsConstructorDescriptionCreates new ByteBuffer with capacity 128ByteBuffer(int size) Creates a byte buffer with a certain capacity. -
Method Summary
Modifier and TypeMethodDescriptionappend(byte b) append_i(int b) Appends anint.byte[]voidsetSize(int size) byte[]Creates a newly allocated byte array.toString()Converts the buffer's contents into a string, translating bytes into characters according to the platform's default character encoding.voidwrite(byte[] b, int off, int len) voidwrite(int b) Methods inherited from class OutputStream
close, flush, nullOutputStream, write
-
Constructor Details
-
ByteBuffer
public ByteBuffer()Creates new ByteBuffer with capacity 128 -
ByteBuffer
public ByteBuffer(int size) Creates a byte buffer with a certain capacity.- Parameters:
size- the initial capacity
-
-
Method Details
-
append_i
Appends anint. The size of the array will grow by one.- Parameters:
b- the int to be appended- Returns:
- a reference to this
ByteBufferobject
-
append
-
toByteArray
public byte[] toByteArray()Creates a newly allocated byte array. Its size is the current size of this output stream and the valid contents of the buffer have been copied into it.- Returns:
- the current contents of this output stream, as a byte array.
-
setSize
public void setSize(int size) -
toString
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) - Overrides:
writein classOutputStream
-
getBuffer
public byte[] getBuffer()
-