Build 1.0_r1(from source)

java.util.logging
Class FileHandler.MeasureOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.util.logging.FileHandler.MeasureOutputStream
All Implemented Interfaces:
Closeable, Flushable
Enclosing class:
FileHandler

static class FileHandler.MeasureOutputStream
extends OutputStream

This output stream use decorator pattern to add measure feature to OutputStream which can detect the total size(in bytes) of output, the initial size can be set


Field Summary
(package private)  long length
           
(package private)  OutputStream wrapped
           
 
Constructor Summary
FileHandler.MeasureOutputStream(OutputStream stream)
           
FileHandler.MeasureOutputStream(OutputStream stream, long currentLength)
           
 
Method Summary
 void close()
          Close this OutputStream.
 void flush()
          Flush this OutputStream.
 long getLength()
           
 void setLength(long newLength)
           
 void write(byte[] bytes)
          Writes the entire contents of the byte array buffer to this OutputStream.
 void write(byte[] b, int off, int len)
          Writes count bytes from the byte array buffer starting at offset to this OutputStream.
 void write(int oneByte)
          Writes the specified byte oneByte to this OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wrapped

OutputStream wrapped

length

long length
Constructor Detail

FileHandler.MeasureOutputStream

public FileHandler.MeasureOutputStream(OutputStream stream,
                                       long currentLength)

FileHandler.MeasureOutputStream

public FileHandler.MeasureOutputStream(OutputStream stream)
Method Detail

write

public void write(int oneByte)
           throws IOException
Description copied from class: OutputStream
Writes the specified byte oneByte to this OutputStream. Only the low order byte of oneByte is written.

Specified by:
write in class OutputStream
Parameters:
oneByte - the byte to be written
Throws:
IOException - If an error occurs attempting to write to this OutputStream.

write

public void write(byte[] bytes)
           throws IOException
Description copied from class: OutputStream
Writes the entire contents of the byte array buffer to this OutputStream.

Overrides:
write in class OutputStream
Parameters:
bytes - the buffer to be written
Throws:
IOException - If an error occurs attempting to write to this OutputStream.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Description copied from class: OutputStream
Writes count bytes from the byte array buffer starting at offset to this OutputStream.

Overrides:
write in class OutputStream
Parameters:
b - the buffer to be written
off - offset in buffer to get bytes
len - number of bytes in buffer to write
Throws:
IOException - If an error occurs attempting to write to this OutputStream.

close

public void close()
           throws IOException
Description copied from class: OutputStream
Close this OutputStream. Concrete implementations of this class should free any resources during close. This implementation does nothing.

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException - If an error occurs attempting to close this OutputStream.

flush

public void flush()
           throws IOException
Description copied from class: OutputStream
Flush this OutputStream. Concrete implementations of this class should ensure any pending writes to the underlying stream are written out when this method is envoked. This implementation does nothing.

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException - If an error occurs attempting to flush this OutputStream.

getLength

public long getLength()

setLength

public void setLength(long newLength)

Build 1.0_r1(from source)

Please submit a feedback, bug or feature