Save This Page
Home » iText-2.1.7 » com.lowagie » text » pdf » [javadoc | source]
com.lowagie.text.pdf
public class: ByteBuffer [javadoc | source]
java.lang.Object
   java.io.OutputStream
      com.lowagie.text.pdf.ByteBuffer

All Implemented Interfaces:
    Closeable, Flushable

Acts like a StringBuffer but works with byte arrays. Floating point is converted to a format suitable to the PDF.
Field Summary
protected  int count    The count of bytes in the buffer. 
protected  byte[] buf    The buffer where the bytes are stored. 
public static final  byte ZERO     
public static  boolean HIGH_PRECISION    If true always output floating point numbers with 6 decimal digits. If false uses the faster, although less precise, representation. 
Constructor:
 public ByteBuffer() 
 public ByteBuffer(int size) 
Method from com.lowagie.text.pdf.ByteBuffer Summary:
append,   append,   append,   append,   append,   append,   append,   append,   append,   appendHex,   append_i,   fillCache,   formatDouble,   formatDouble,   getBuffer,   reset,   setCacheSize,   setSize,   size,   toByteArray,   toString,   toString,   write,   write,   writeTo
Methods from java.io.OutputStream:
close,   flush,   write,   write,   write
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.lowagie.text.pdf.ByteBuffer Detail:
 public ByteBuffer append(byte[] b) 
    Appends an array of bytes.
 public ByteBuffer append(String str) 
    Appends a String to the buffer. The String is converted according to the encoding ISO-8859-1.
 public ByteBuffer append(char c) 
    Appends a char to the buffer. The char is converted according to the encoding ISO-8859-1.
 public ByteBuffer append(ByteBuffer buf) 
    Appends another ByteBuffer to this buffer.
 public ByteBuffer append(int i) 
    Appends the string representation of an int.
 public ByteBuffer append(byte b) 
 public ByteBuffer append(float i) 
    Appends a string representation of a float according to the Pdf conventions.
 public ByteBuffer append(double d) 
    Appends a string representation of a double according to the Pdf conventions.
 public ByteBuffer append(byte[] b,
    int off,
    int len) 
    Appends the subarray of the byte array. The buffer will grow by len bytes.
 public ByteBuffer appendHex(byte b) 
 public ByteBuffer append_i(int b) 
    Appends an int. The size of the array will grow by one.
 public static  void fillCache(int decimals) 
    You can fill the cache in advance if you want to.
 public static String formatDouble(double d) 
    Outputs a double into a format suitable for the PDF.
 public static String formatDouble(double d,
    ByteBuffer buf) 
    Outputs a double into a format suitable for the PDF.
 public byte[] getBuffer() 
 public  void reset() 
    Sets the size to zero.
 public static  void setCacheSize(int size) 
    Sets the cache size.

    This can only be used to increment the size. If the size that is passed through is smaller than the current size, nothing happens.

 public  void setSize(int size) 
 public int size() 
    Returns the current size of the buffer.
 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.
 public String toString() 
    Converts the buffer's contents into a string, translating bytes into characters according to the platform's default character encoding.
 public String toString(String enc) throws UnsupportedEncodingException 
    Converts the buffer's contents into a string, translating bytes into characters according to the specified character encoding.
 public  void write(int b) throws IOException 
 public  void write(byte[] b,
    int off,
    int len) 
 public  void writeTo(OutputStream out) throws IOException 
    Writes the complete contents of this byte buffer output to the specified output stream argument, as if by calling the output stream's write method using out.write(buf, 0, count).