org.apache.derby.iapi.services.io
Class AccessibleByteArrayOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.ByteArrayOutputStream
          extended byorg.apache.derby.iapi.services.io.AccessibleByteArrayOutputStream

public class AccessibleByteArrayOutputStream
extends java.io.ByteArrayOutputStream

This allows us to get to the byte array to go back and edit contents or get the array without having a copy made.

Since a copy is not made, users must be careful that no more writes are made to the stream if the array reference is handed off.

Users of this must make the modifications *before* the next write is done, and then release their hold on the array.


Field Summary
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
AccessibleByteArrayOutputStream()
           
AccessibleByteArrayOutputStream(int size)
           
 
Method Summary
 byte[] getInternalByteArray()
          The caller promises to set their variable to null before any other calls to write to this stream are made.
 
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

AccessibleByteArrayOutputStream

public AccessibleByteArrayOutputStream()

AccessibleByteArrayOutputStream

public AccessibleByteArrayOutputStream(int size)
Method Detail

getInternalByteArray

public byte[] getInternalByteArray()
The caller promises to set their variable to null before any other calls to write to this stream are made. Or promises to throw away references to the stream before passing the array reference out of its control.


Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.