com.caucho.vfs
Class TempBuffer

java.lang.Object
  extended by com.caucho.vfs.TempBuffer
All Implemented Interfaces:
java.io.Serializable

public class TempBuffer
extends java.lang.Object
implements java.io.Serializable

Pooled temporary byte buffer.

See Also:
Serialized Form

Field Summary
static int SIZE
           
 
Constructor Summary
TempBuffer(int size)
          Create a new TempBuffer.
 
Method Summary
static TempBuffer allocate()
          Allocate a TempBuffer, reusing one if available.
 void clear()
          Clears the buffer.
static TempBuffer copyFromStream(ReadStream is)
           
static void free(TempBuffer buf)
          Frees a single buffer.
static void freeAll(TempBuffer buf)
           
 int getAvailable()
           
 byte[] getBuffer()
          Returns the buffer's underlying byte array.
 int getCapacity()
           
 int getLength()
          Returns the number of bytes in the buffer.
 TempBuffer getNext()
           
static boolean isSmallmem()
          Returns true for a smallmem configuration
 void setLength(int length)
          Sets the number of bytes used in the buffer.
 void setNext(TempBuffer next)
           
 int write(byte[] buf, int offset, int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZE

public static final int SIZE
Constructor Detail

TempBuffer

public TempBuffer(int size)
Create a new TempBuffer.

Method Detail

isSmallmem

public static boolean isSmallmem()
Returns true for a smallmem configuration


allocate

public static TempBuffer allocate()
Allocate a TempBuffer, reusing one if available.


clear

public void clear()
Clears the buffer.


getBuffer

public final byte[] getBuffer()
Returns the buffer's underlying byte array.


getLength

public final int getLength()
Returns the number of bytes in the buffer.


setLength

public final void setLength(int length)
Sets the number of bytes used in the buffer.


getCapacity

public final int getCapacity()

getAvailable

public int getAvailable()

getNext

public final TempBuffer getNext()

setNext

public final void setNext(TempBuffer next)

write

public int write(byte[] buf,
                 int offset,
                 int length)

copyFromStream

public static TempBuffer copyFromStream(ReadStream is)
                                 throws java.io.IOException
Throws:
java.io.IOException

free

public static void free(TempBuffer buf)
Frees a single buffer.


freeAll

public static void freeAll(TempBuffer buf)