Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## things.thinger.io
Class EchoInputStream

    java.lang.Object
      java.io.InputStream
          things.thinger.io.EchoInputStream

All Implemented Interfaces:
  java.io.Closeable

    public class EchoInputStream

extends java.io.InputStream

An echoing input stream.

It is a good idea to flush() this before letting anything else use the echoStream. I did a bunch of flushed inline, but it really slowed things down.

Calling close will do nothing. It's up to the user to decide the fate of the streams.

Version:
  1.0
  Version History
  `EPG - New - 20Feb05`
Author:
  Erich P. Gatejen

Constructor Summary
`EchoInputStream(java.io.InputStream source, java.io.OutputStream echoStream)` Constructor.

Method Summary
`int` | `available()` Returns the number of characters available for read without blocking.
`void` | `close()` Close.
`void` | `mark(int readlimit)` Mark does nothing.
`boolean` | `markSupported()` Mark does nothing so this will always return false.
`int` | `read()` Read a single character.
`int` | `read(byte[] b)` Reads into an array.
`int` | `read(byte[] b, int off, int len)` Reads into an array from an offset.
`void` | `reset()` Reset is not supported and will always throw and IOException.
`long` | `skip(long n)` Skip is not supported and will always throw an IOException.

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

Constructor Detail

### EchoInputStream

    public EchoInputStream(java.io.InputStream source,
                           java.io.OutputStream echoStream)
                    throws java.lang.Exception

  Constructor. This is a one-use echo.

  Parameters:
    `source` - The input stream.
    `echoStream` - Where to echo everything.
  Throws:
    `java.lang.Exception`

Method Detail

### close

    public void close()
               throws java.io.IOException

  Close. This is a NOP. It is up to the users to close streams.

  Specified by:
    `close` in interface `java.io.Closeable`
  Overrides:
    `close` in class `java.io.InputStream`
  Throws:
    `java.io.IOException`

### read

    public int read()
             throws java.io.IOException

  Read a single character. It will echo to the echo stream before returning.

  Specified by:
    `read` in class `java.io.InputStream`
  Returns:
    the character.
  Throws:
    `java.io.IOException`

### read

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

  Reads into an array. It will echo to the echo stream before returning.

  Overrides:
    `read` in class `java.io.InputStream`
  Parameters:
    `b` - the destination array.
  Returns:
    the number of bytes read.
  Throws:
    `java.io.IOException`

### read

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

  Reads into an array from an offset. It will echo to the echo stream before returning.

  Overrides:
    `read` in class `java.io.InputStream`
  Parameters:
    `b` - the destination array.
    `off` - the offset in the array.
    `len` - the maximum number to read.
  Returns:
    the number of bytes actually read.
  Throws:
    `java.io.IOException`

### skip

    public long skip(long n)
              throws java.io.IOException

  Skip is not supported and will always throw an IOException.

  Overrides:
    `skip` in class `java.io.InputStream`
  Throws:
    `java.io.IOException`

### available

    public int available()
                  throws java.io.IOException

  Returns the number of characters available for read without blocking.

  Overrides:
    `available` in class `java.io.InputStream`
  Returns:
    the number available.
  Throws:
    `java.io.IOException`

### mark

    public void mark(int readlimit)

  Mark does nothing.

  Overrides:
    `mark` in class `java.io.InputStream`

### reset

    public void reset()
               throws java.io.IOException

  Reset is not supported and will always throw and IOException.

  Overrides:
    `reset` in class `java.io.InputStream`
  Throws:
    `java.io.IOException`

### markSupported

    public boolean markSupported()

  Mark does nothing so this will always return false.

  Overrides:
    `markSupported` in class `java.io.InputStream`
  Returns:
    false

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Things.