prefuse.util.collections
Class ByteArrayList

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream
          extended by prefuse.util.collections.ByteArrayList
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class ByteArrayList
extends java.io.ByteArrayOutputStream

A minor extension to ByteArrayOutputStream which prevents unnecessary copying of data when creating an InputStream.

Author:
jeffrey heer

Field Summary
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
ByteArrayList()
          Creates a new ByteArrayList.
ByteArrayList(int size)
          Creates a new ByteArrayList, with a buffer capacity of the specified size, in bytes.
 
Method Summary
 java.io.InputStream getAsInputStream()
           
 
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, write, write, writeTo
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteArrayList

public ByteArrayList()
Creates a new ByteArrayList. The buffer capacity is initially 32 bytes, though its size increases if necessary.


ByteArrayList

public ByteArrayList(int size)
Creates a new ByteArrayList, with a buffer capacity of the specified size, in bytes.

Parameters:
size - the initial size.
Throws:
java.lang.IllegalArgumentException - if size is negative.
Method Detail

getAsInputStream

public java.io.InputStream getAsInputStream()
Returns:
an InputStream which contains the underlying buffer's data.


Copyright © 2008 Regents of the University of California