ehcache

net.sf.ehcache.store
Class DiskStore.MemoryEfficientByteArrayOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream
          extended by net.sf.ehcache.store.DiskStore.MemoryEfficientByteArrayOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Enclosing class:
DiskStore

 class DiskStore.MemoryEfficientByteArrayOutputStream
extends java.io.ByteArrayOutputStream

This class is designed to minimse the number of System.arraycopy(); methods required to complete.


Field Summary
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
DiskStore.MemoryEfficientByteArrayOutputStream(int size)
          Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.
 
Method Summary
 byte[] getBytes()
          Gets the bytes.
 
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

DiskStore.MemoryEfficientByteArrayOutputStream

public DiskStore.MemoryEfficientByteArrayOutputStream(int size)
Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes.

Parameters:
size - the initial size.
Method Detail

getBytes

public byte[] getBytes()
Gets the bytes. Not all may be valid. Use only up to getSize()

Returns:
the underlying byte[]

ehcache