Xindice API
version 1.2m1

org.apache.xindice.util
Class ByteBuffer

java.lang.Object
  extended byjava.io.OutputStream
      extended byorg.apache.xindice.util.ByteBuffer
All Implemented Interfaces:
Serializable

public final class ByteBuffer
extends OutputStream
implements Serializable

ByteBuffer manages volatile arrays of bytes. It is implemented with nearly the same method prototypes as StringBuffer except for the setByteAt and byteAt methods which replace StringBuffer's setCharAt and charAt methods. ByteBuffer also extends the OutputStream abstract class and functions like the ByteArrayOutputStream class. getInputStream returns an InputStream instance for streaming in the content of the ByteBuffer. Because none of the methods in ByteBuffer are synchronized, it is the user's job to properly synchronize calls to any of the methods of this class.

Version:
$Revision: 541508 $, $Date: 2007-05-24 21:54:12 -0400 (Thu, 24 May 2007) $
See Also:
Serialized Form

Constructor Summary
ByteBuffer()
           
ByteBuffer(byte[] value)
           
ByteBuffer(byte[] value, boolean copy)
           
ByteBuffer(int size)
           
ByteBuffer(String value)
           
ByteBuffer(StringBuffer value)
           
 
Method Summary
 void append(boolean value)
           
 void append(byte value)
           
 void append(byte[] value)
           
 void append(ByteBuffer value)
           
 void append(char value)
           
 void append(char[] value)
           
 void append(double value)
           
 void append(float value)
           
 void append(int value)
           
 void append(long value)
           
 void append(Object value)
           
 void append(String value)
           
 void append(StringBuffer value)
           
 byte byteAt(int index)
           
 int capacity()
           
 void chunkTo(OutputStream out)
           
 void chunkTo(OutputStream out, int chunkSize)
           
 void delete(int pos, int width)
           
 void ensureCapacity(int size)
           
 InputStream getInputStream()
           
 void insert(boolean value, int pos)
           
 void insert(byte[] value, int pos)
           
 void insert(ByteBuffer value, int pos)
           
 void insert(byte value, int pos)
           
 void insert(char[] value, int pos)
           
 void insert(char value, int pos)
           
 void insert(double value, int pos)
           
 void insert(float value, int pos)
           
 void insert(int value, int pos)
           
 void insert(long value, int pos)
           
 void insert(Object value, int pos)
           
 void insert(StringBuffer value, int pos)
           
 void insert(String value, int pos)
           
 boolean isLocked()
           
 int length()
           
 void lock()
           
 void pack()
           
 void readFrom(InputStream in)
           
 void replace(boolean value, int pos, int width)
           
 void replace(byte[] value, int pos, int width)
           
 void replace(ByteBuffer value, int pos, int width)
           
 void replace(char value, int pos, int width)
           
 void replace(double value, int pos, int width)
           
 void replace(float value, int pos, int width)
           
 void replace(int value, int pos, int width)
           
 void replace(long value, int pos, int width)
           
 void replace(Object value, int pos, int width)
           
 void replace(StringBuffer value, int pos, int width)
           
 void replace(String value, int pos, int width)
           
 void reset()
           
 void reverse()
           
 void setByteAt(int index, byte value)
           
 void setLength(int value)
           
 int size()
           
 byte[] toByteArray()
           
 String toString()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 void writeTo(OutputStream out)
           
 
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
 

Constructor Detail

ByteBuffer

public ByteBuffer(int size)

ByteBuffer

public ByteBuffer(String value)

ByteBuffer

public ByteBuffer(StringBuffer value)

ByteBuffer

public ByteBuffer(byte[] value,
                  boolean copy)

ByteBuffer

public ByteBuffer(byte[] value)

ByteBuffer

public ByteBuffer()
Method Detail

capacity

public int capacity()

ensureCapacity

public void ensureCapacity(int size)

pack

public void pack()

append

public void append(byte[] value)

append

public void append(char[] value)

append

public void append(String value)

append

public void append(StringBuffer value)

append

public void append(ByteBuffer value)

append

public void append(boolean value)

append

public void append(char value)

append

public void append(byte value)

append

public void append(double value)

append

public void append(float value)

append

public void append(int value)

append

public void append(long value)

append

public void append(Object value)

insert

public void insert(byte[] value,
                   int pos)

insert

public void insert(char[] value,
                   int pos)

insert

public void insert(String value,
                   int pos)

insert

public void insert(StringBuffer value,
                   int pos)

insert

public void insert(ByteBuffer value,
                   int pos)

insert

public void insert(boolean value,
                   int pos)

insert

public void insert(char value,
                   int pos)

insert

public void insert(byte value,
                   int pos)

insert

public void insert(double value,
                   int pos)

insert

public void insert(float value,
                   int pos)

insert

public void insert(int value,
                   int pos)

insert

public void insert(long value,
                   int pos)

insert

public void insert(Object value,
                   int pos)

delete

public void delete(int pos,
                   int width)

replace

public void replace(byte[] value,
                    int pos,
                    int width)

replace

public void replace(String value,
                    int pos,
                    int width)

replace

public void replace(StringBuffer value,
                    int pos,
                    int width)

replace

public void replace(ByteBuffer value,
                    int pos,
                    int width)

replace

public void replace(boolean value,
                    int pos,
                    int width)

replace

public void replace(char value,
                    int pos,
                    int width)

replace

public void replace(double value,
                    int pos,
                    int width)

replace

public void replace(float value,
                    int pos,
                    int width)

replace

public void replace(int value,
                    int pos,
                    int width)

replace

public void replace(long value,
                    int pos,
                    int width)

replace

public void replace(Object value,
                    int pos,
                    int width)

toByteArray

public byte[] toByteArray()

toString

public String toString()

length

public int length()

setLength

public void setLength(int value)

size

public int size()

reset

public void reset()

byteAt

public byte byteAt(int index)

setByteAt

public void setByteAt(int index,
                      byte value)

reverse

public void reverse()

getInputStream

public InputStream getInputStream()

writeTo

public void writeTo(OutputStream out)
             throws IOException
Throws:
IOException

chunkTo

public void chunkTo(OutputStream out,
                    int chunkSize)
             throws IOException
Throws:
IOException

chunkTo

public void chunkTo(OutputStream out)
             throws IOException
Throws:
IOException

readFrom

public void readFrom(InputStream in)
              throws IOException
Throws:
IOException

write

public void write(int b)
           throws IOException
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Throws:
IOException

lock

public void lock()

isLocked

public boolean isLocked()

Xindice API
version 1.2m1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.