org.netbeans.lib.cvsclient.util
Class LoggedDataInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.netbeans.lib.cvsclient.util.LoggedDataInputStream
All Implemented Interfaces:
Closeable

public class LoggedDataInputStream
extends FilterInputStream

This input stream worked exactly like the normal DataInputStream except that it logs anything read to a file

Author:
Robert Greig

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
LoggedDataInputStream(InputStream in)
          Construct a logged stream using the specified underlying stream
 
Method Summary
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 long getCounter()
           
 InputStream getUnderlyingStream()
           
 int read()
          Interruptible read.
 int read(byte[] b)
          Reads up to byte.length bytes of data from this input stream into an array of bytes.
 int read(byte[] b, int off, int len)
          Reads up to len bytes of data from this input stream into an array of bytes
 byte[] readBytes(int len)
          Synchronously reads fixed chunk from the stream, logging it too.
 String readLine()
          Deprecated. It converts input data to string using ByteArray.getStringFromBytes() that works only for ASCII without 0. Use byte access methods instead.
 ByteArray readLineBytes()
           
 void setUnderlyingStream(InputStream is)
           
 long skip(long n)
           
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggedDataInputStream

public LoggedDataInputStream(InputStream in)
Construct a logged stream using the specified underlying stream

Parameters:
in - the stream
Method Detail

readLine

public String readLine()
                throws IOException
Deprecated. It converts input data to string using ByteArray.getStringFromBytes() that works only for ASCII without 0. Use byte access methods instead.

Read a line (up to the newline character) from the stream, logging it too.

Throws:
IOException

readLineBytes

public ByteArray readLineBytes()
                        throws IOException
Returns:
Throws:
IOException
EOFException - at stream end

readBytes

public byte[] readBytes(int len)
                 throws IOException
Synchronously reads fixed chunk from the stream, logging it too.

Parameters:
len - blocks until specifid number of bytes is read.
Throws:
IOException

close

public void close()
           throws IOException
Closes this input stream and releases any system resources associated with the stream.

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

read

public int read(byte[] b)
         throws IOException
Reads up to byte.length bytes of data from this input stream into an array of bytes.

Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Reads up to len bytes of data from this input stream into an array of bytes

Overrides:
read in class FilterInputStream
Throws:
IOException

skip

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

read

public int read()
         throws IOException
Interruptible read.

Overrides:
read in class FilterInputStream
Throws:
InterruptedIOException - on thread interrupt
IOException

getUnderlyingStream

public InputStream getUnderlyingStream()

setUnderlyingStream

public void setUnderlyingStream(InputStream is)

getCounter

public long getCounter()


Copyright © 2011. All Rights Reserved.