    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.util.CountOutputStream

    java.lang.Object
       |
       +----java.io.OutputStream
               |
               +----org.w3c.util.CountOutputStream

public class CountOutputStream
extends OutputStream

This class can be used to count number of bytes emitted to a stream. The stream will actually throw the data away. It's main function is to count the number of bytes emitted to a stream before actually emitting the bytes (that's not really efficient, but works enough).

##

count

##

CountOutputStream()
  Create a new instance of that class.

##

close()
  Close that count stream.
flush()
  Flush that count stream.
getCount()
  Get the current number of bytes emitted to that stream.
write(byte[])
  Write an array of bytes to that stream.
write(byte[], int, int)
  Write part of an array of bytes to that stream.
write(int)
  Write a single byte to that stream.

##

count

     protected int count

##

CountOutputStream

     public CountOutputStream()

  Create a new instance of that class.

##

getCount

     public int getCount()

  Get the current number of bytes emitted to that stream.

  Returns:
    The current count value.

close

     public void close()

  Close that count stream.

  Overrides:
    close in class OutputStream

flush

     public void flush()

  Flush that count stream.

  Overrides:
    flush in class OutputStream

write

     public void write(byte b[])

  Write an array of bytes to that stream.

  Overrides:
    write in class OutputStream

write

     public void write(byte b[],
                       int off,
                       int len)

  Write part of an array of bytes to that stream.

  Overrides:
    write in class OutputStream

write

     public void write(int b)

  Write a single byte to that stream.

  Overrides:
    write in class OutputStream

    All Packages  Class Hierarchy  This Package  Previous  Next  Index