com.gc.iotools.stream.base
Class AbstractInputStreamWrapper

java.lang.Object
  extended by java.io.InputStream
      extended by com.gc.iotools.stream.base.AbstractInputStreamWrapper
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
RandomAccessInputStream, TeeInputStreamOutputStream

public abstract class AbstractInputStreamWrapper
extends InputStream

Provides common functionality to the easystream library:

Since:
1.2.0
Version:
$Id: AbstractInputStreamWrapper.java 463 2011-01-21 23:54:17Z dvd.smnt@gmail.com $
Author:
dvd.smnt

Field Summary
protected  boolean closeCalled
           
protected  InputStream source
           
 
Constructor Summary
protected AbstractInputStreamWrapper(InputStream source)
          Constructor for AbstractInputStreamWrapper.
 
Method Summary
 void close()
          
protected abstract  void closeOnce()
          closeOnce
protected abstract  int innerRead(byte[] b, int off, int len)
          innerRead
 int read()
          
 int read(byte[] b, int off, int len)
          
 long skip(long n)
          
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

closeCalled

protected boolean closeCalled

source

protected final InputStream source
Constructor Detail

AbstractInputStreamWrapper

protected AbstractInputStreamWrapper(InputStream source)

Constructor for AbstractInputStreamWrapper.

Parameters:
the - InputStream that is wrapped by this stream..
Method Detail

close

public void close()
           throws IOException

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

closeOnce

protected abstract void closeOnce()
                           throws IOException

closeOnce

Throws:
IOException - if any error occurs reading the bytes.

innerRead

protected abstract int innerRead(byte[] b,
                                 int off,
                                 int len)
                          throws IOException

innerRead

Parameters:
b - an array of byte.
off - a int.
len - a int.
Returns:
a int.
Throws:
IOException - if any error occurs reading the bytes.

read

public int read()
         throws IOException

Specified by:
read in class InputStream
Throws:
IOException

read

public final int read(byte[] b,
                      int off,
                      int len)
               throws IOException

Overrides:
read in class InputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException

Overrides:
skip in class InputStream
Throws:
IOException


Copyright © 2008-2011. All Rights Reserved.