Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.util
Class MeteredInputStream

    java.lang.Object
      java.io.InputStream
          java.io.FilterInputStream
              com.compoze.util.MeteredInputStream

public class MeteredInputStream
extends java.io.FilterInputStream

This class provides a `FilterInputStream` that performs several testing/monitoring functions:

1. Count the number of bytes that are read
2. Calculate the total average bytes / sec
3. Calculate the average read length
4. Optionally allow throughput restrictions for testing purposes
5. Optionally calculate a checksum of all data read

Nested Class Summary
`static class` | `MeteredInputStream.RandomInputStream` A NullInputStream for testing purposes.

Field Summary

Fields inherited from class java.io.FilterInputStream
`in`

Constructor Summary
`MeteredInputStream(java.io.InputStream in)` Constructor.
`MeteredInputStream(java.io.InputStream in, boolean bCalculateChecksum)` Constructor.
`MeteredInputStream(java.io.InputStream in, int iMaxBytesPerSecond, boolean bCalculateChecksum)` Constructor.

Method Summary
`void` | `close()` Closes the `InputStream`.
`int` | `getAverageWriteLength()` Gets the average write length that has been issued.
`double` | `getBytesPerSecond()` Gets the number of bytes per second that have been read since the `InputStream` was instantiated.
`long` | `getBytesRead()` Gets the number of bytes that have been read so far.
`long` | `getChecksum()` Gets a checksum of all of the data that has been read.
`static void` | `main(java.lang.String[] args)` Main.
`int` | `read()` Writes a single byte.
`int` | `read(byte[] b)` Reads a byte array.
`int` | `read(byte[] b, int iOffset, int iLength)` Reads a byte array.
`java.lang.String` | `toString()` Creates a string representation of the output stream.

Methods inherited from class java.io.FilterInputStream
`available, mark, markSupported, reset, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MeteredInputStream

    public MeteredInputStream(java.io.InputStream in)

  Constructor.

### MeteredInputStream

    public MeteredInputStream(java.io.InputStream in,
                              boolean bCalculateChecksum)

  Constructor.

### MeteredInputStream

    public MeteredInputStream(java.io.InputStream in,
                              int iMaxBytesPerSecond,
                              boolean bCalculateChecksum)

  Constructor.

Method Detail

### close

    public void close()
               throws java.io.IOException

  Closes the `InputStream`.

  Throws:
    `java.io.IOException`

### read

    public int read(byte[] b)
             throws java.io.IOException

  Reads a byte array.

  Throws:
    `java.io.IOException`

### read

    public int read(byte[] b,
                    int iOffset,
                    int iLength)
             throws java.io.IOException

  Reads a byte array.

  Throws:
    `java.io.IOException`

### read

    public int read()
             throws java.io.IOException

  Writes a single byte.

  Throws:
    `java.io.IOException`

### getBytesRead

    public long getBytesRead()

  Gets the number of bytes that have been read so far.

### getAverageWriteLength

    public int getAverageWriteLength()

  Gets the average write length that has been issued.

### getBytesPerSecond

    public double getBytesPerSecond()

  Gets the number of bytes per second that have been read since the `InputStream` was instantiated.

### getChecksum

    public long getChecksum()

  Gets a checksum of all of the data that has been read.

### toString

    public java.lang.String toString()

  Creates a string representation of the output stream.

### main

    public static void main(java.lang.String[] args)

  Main.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.