Liferay 6.2-ce-ga5

com.liferay.portal.kernel.io
Class RestrictedByteArrayCacheOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.liferay.portal.kernel.io.RestrictedByteArrayCacheOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class RestrictedByteArrayCacheOutputStream
extends OutputStream


Nested Class Summary
static interface RestrictedByteArrayCacheOutputStream.FlushPreAction
           
 
Field Summary
protected  byte[] cache
           
protected  int cacheCapacity
           
protected  RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction
           
protected  int index
           
protected  OutputStream outputStream
           
protected  boolean overflowed
           
 
Constructor Summary
RestrictedByteArrayCacheOutputStream(OutputStream outputStream, int initialCacheSize, int cacheCapacity, RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction)
           
RestrictedByteArrayCacheOutputStream(OutputStream outputStream, int cacheCapacity, RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction)
           
 
Method Summary
protected  void ensureCacheSize(int newIndex)
           
 void flush()
           
 int getCacheCapacity()
           
 boolean isOverflowed()
           
 void reset()
           
 int size()
           
 byte[] toByteArray()
           
 byte[] unsafeGetByteArray()
           
 ByteBuffer unsafeGetByteBuffer()
           
 void write(byte[] bytes)
           
 void write(byte[] bytes, int offset, int length)
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected byte[] cache

cacheCapacity

protected int cacheCapacity

flushPreAction

protected RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction

index

protected int index

outputStream

protected OutputStream outputStream

overflowed

protected boolean overflowed
Constructor Detail

RestrictedByteArrayCacheOutputStream

public RestrictedByteArrayCacheOutputStream(OutputStream outputStream,
                                            int cacheCapacity,
                                            RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction)

RestrictedByteArrayCacheOutputStream

public RestrictedByteArrayCacheOutputStream(OutputStream outputStream,
                                            int initialCacheSize,
                                            int cacheCapacity,
                                            RestrictedByteArrayCacheOutputStream.FlushPreAction flushPreAction)
Method Detail

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

getCacheCapacity

public int getCacheCapacity()

isOverflowed

public boolean isOverflowed()

reset

public void reset()

size

public int size()

toByteArray

public byte[] toByteArray()

unsafeGetByteArray

public byte[] unsafeGetByteArray()

unsafeGetByteBuffer

public ByteBuffer unsafeGetByteBuffer()

write

public void write(byte[] bytes)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] bytes,
                  int offset,
                  int length)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

ensureCacheSize

protected void ensureCacheSize(int newIndex)

Liferay 6.2-ce-ga5