org.basex.io
Class CachedOutput

java.lang.Object
  extended by java.io.OutputStream
      extended by org.basex.io.PrintOutput
          extended by org.basex.io.CachedOutput
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public final class CachedOutput
extends PrintOutput

This class caches the output bytes in an array. If a maximum is specified, the returned byte array contains a notice that the output was chopped in case there was more data than specified by the limit.

Author:
Workgroup DBIS, University of Konstanz 2005-07, ISC License, Christian Gruen, Tim Petrowsky

Constructor Summary
CachedOutput()
          Default constructor.
CachedOutput(int m)
          Constructor, specifying the maximum number of bytes to write.
 
Method Summary
 byte[] finish()
          Returns the output as byte array.
 boolean finished()
          Checks if stream can output more characters; overwritten by CachedOutput to allow interruptions when the buffer is full.
 void reset()
          Resets the output array.
 java.lang.String toString()
           
 void write(int b)
           
 
Methods inherited from class org.basex.io.PrintOutput
close, flush, print, print, print, println, println, println, printToken, size
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachedOutput

public CachedOutput()
Default constructor.


CachedOutput

public CachedOutput(int m)
Constructor, specifying the maximum number of bytes to write.

Parameters:
m - maximum
Method Detail

finish

public byte[] finish()
Returns the output as byte array.

Returns:
byte array

finished

public boolean finished()
Description copied from class: PrintOutput
Checks if stream can output more characters; overwritten by CachedOutput to allow interruptions when the buffer is full.

Overrides:
finished in class PrintOutput
Returns:
result of check

reset

public void reset()
Resets the output array.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

write

public void write(int b)
Overrides:
write in class PrintOutput