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:
java.io.Closeable

public class LoggedDataInputStream
extends java.io.FilterInputStream

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


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
LoggedDataInputStream(java.io.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()
           
 java.io.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.
 java.lang.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(java.io.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(java.io.InputStream in)
Construct a logged stream using the specified underlying stream

Parameters:
in - the stream
Method Detail

readLine

public java.lang.String readLine()
                          throws java.io.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:
java.io.IOException

readLineBytes

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

readBytes

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

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

close

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

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

read

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

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

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

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

skip

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

read

public int read()
         throws java.io.IOException
Interruptible read.

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

getUnderlyingStream

public java.io.InputStream getUnderlyingStream()

setUnderlyingStream

public void setUnderlyingStream(java.io.InputStream is)

getCounter

public long getCounter()

 

Built on October 26 2010.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.