org.norther.tammi.acorn.io
Class CollectorInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.norther.tammi.acorn.io.InputStreamAdapter
          extended by org.norther.tammi.acorn.io.CollectorInputStream
All Implemented Interfaces:
Closeable

public class CollectorInputStream
extends InputStreamAdapter

An input stream adapter collecting read input into its internal buffer.

Version:
$Id: CollectorInputStream.java,v 1.8 2009/09/29 12:34:42 cvsimp Exp $
Author:
Ilkka Priha

Constructor Summary
CollectorInputStream(InputStream in)
          Constructs a new collector input stream.
 
Method Summary
 int getByteCount()
          Gets the number of collected bytes.
 byte[] getBytes()
          Gets the byte buffer.
 void mark(int readlimit)
           
 int read()
           
 int read(byte[] bb)
           
 int read(byte[] bb, int off, int len)
           
 void reset()
           
 void reset(InputStream in)
          Resets the collector for a new stream.
 long skip(long n)
           
 
Methods inherited from class org.norther.tammi.acorn.io.InputStreamAdapter
available, close, getInputStream, markSupported, setInputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectorInputStream

public CollectorInputStream(InputStream in)
Constructs a new collector input stream.

Parameters:
in - an input stream adaptee.
Method Detail

read

public int read()
         throws IOException
Overrides:
read in class InputStreamAdapter
Throws:
IOException

read

public int read(byte[] bb)
         throws IOException
Overrides:
read in class InputStreamAdapter
Throws:
IOException

read

public int read(byte[] bb,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStreamAdapter
Throws:
IOException

mark

public void mark(int readlimit)
Overrides:
mark in class InputStreamAdapter

reset

public void reset()
           throws IOException
Overrides:
reset in class InputStreamAdapter
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class InputStreamAdapter
Throws:
IOException

reset

public void reset(InputStream in)
Resets the collector for a new stream.

Parameters:
in - a new input stream.

getByteCount

public int getByteCount()
Gets the number of collected bytes.

Returns:
the number of collected bytes.

getBytes

public byte[] getBytes()
Gets the byte buffer.

Returns:
the byte buffer.


Copyright © 2004 The Norther Organization. All rights reserved.