org.wings
Class StaticResource.LimitedBuffer

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream
          extended by org.wings.StaticResource.LimitedBuffer
All Implemented Interfaces:
Closeable, Flushable
Enclosing class:
StaticResource

protected static final class StaticResource.LimitedBuffer
extends ByteArrayOutputStream

An ByteArrayOutputStream that buffers up to the limit MAX_SIZE_TO_BUFFER. Is able to write to an Device.


Field Summary
static int MAX_SIZE_TO_BUFFER
           
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Method Summary
 byte[] getBytes()
          returns the _raw_ buffer; i.e.
 boolean isValid()
          returns, whether the filled buffer is within the limits, and thus, its content is valid and can be used.
 void setValid(boolean valid)
          sets, whether this resource is valid.
 void write(byte[] b, int off, int len)
          write to the stream.
 void writeTo(Device out)
          write to some output device.
 
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, 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
 

Field Detail

MAX_SIZE_TO_BUFFER

public static final int MAX_SIZE_TO_BUFFER
See Also:
Constant Field Values
Method Detail

write

public void write(byte[] b,
                  int off,
                  int len)
write to the stream. If the output size exceeds the limit, then set the stream to error state.

Overrides:
write in class ByteArrayOutputStream

isValid

public boolean isValid()
returns, whether the filled buffer is within the limits, and thus, its content is valid and can be used.


setValid

public void setValid(boolean valid)
sets, whether this resource is valid.


getBytes

public byte[] getBytes()
returns the _raw_ buffer; i.e. the buffer may be larger than the current size().


writeTo

public void writeTo(Device out)
             throws IOException
write to some output device.

Throws:
IOException


wingS Swings ;-)