org.objectweb.cjdbc.common.stream
Class CJDBCInputStream

java.lang.Object
  extended byorg.objectweb.cjdbc.common.stream.CJDBCInputStream

public class CJDBCInputStream
extends java.lang.Object

This class is to provide an ObjectInputStream implementation, but we cannot override the readObject method, so we made as a wrapper. The CJDBCInputStream in pair with the CJDBCOutputStream offers a five times compression using the java Inflater and Deflater class. useCompression can be set to on or off anytime.

Author:
Nicolas Modrzyk

Field Summary
private  long bytesRead
           
private  long dateCreated
           
private  java.io.ObjectInputStream input
           
private  java.net.Socket socket
           
private  long speed
           
private  boolean useCompression
           
 
Constructor Summary
CJDBCInputStream(java.io.InputStream in)
          Creates a new CJDBCInputStream from the given input stream.
CJDBCInputStream(java.net.Socket socket)
          Useful constructor for statistics on sockets ..
 
Method Summary
 int available()
           
 void close()
           
 long getBytesRead()
           
 long getDateCreated()
           
 java.net.Socket getSocket()
           
 long getSpeed()
           
 boolean getUseCompression()
           
 boolean readBoolean()
           
 int readInt()
           
 long readLong()
           
 java.lang.Object readObject()
           
 java.lang.String readUTF()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

input

private java.io.ObjectInputStream input

bytesRead

private long bytesRead

socket

private java.net.Socket socket

useCompression

private boolean useCompression

speed

private long speed

dateCreated

private long dateCreated
Constructor Detail

CJDBCInputStream

public CJDBCInputStream(java.io.InputStream in)
                 throws java.io.IOException,
                        java.io.StreamCorruptedException
Creates a new CJDBCInputStream from the given input stream.

Parameters:
in - inputstream to wrap
Throws:
java.io.IOException - if new ObjectInputStream() throws anException
java.io.StreamCorruptedException - same as above

CJDBCInputStream

public CJDBCInputStream(java.net.Socket socket)
                 throws java.io.IOException,
                        java.io.StreamCorruptedException
Useful constructor for statistics on sockets ..

Parameters:
socket - socket for this stream
Throws:
java.io.IOException - if an error occurs
java.io.StreamCorruptedException - if an error occurs
Method Detail

readObject

public java.lang.Object readObject()
                            throws java.lang.ClassNotFoundException,
                                   java.io.IOException,
                                   java.io.OptionalDataException
Returns:
the Object read from the stream
Throws:
java.lang.ClassNotFoundException - if an error occurs
java.io.IOException - if an error occurs
java.io.OptionalDataException - if an error occurs
See Also:
ObjectInputStream.readObject()

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException - if an error occurs
See Also:
ObjectInputStream.close()

readBoolean

public boolean readBoolean()
                    throws java.io.IOException
Returns:
a boolean value
Throws:
java.io.IOException - if an error occurs
See Also:
ObjectInputStream.readBoolean()

readInt

public int readInt()
            throws java.io.IOException
Returns:
an int value
Throws:
java.io.IOException - if an error occurs
See Also:
ObjectInputStream.readInt()

readLong

public long readLong()
              throws java.io.IOException
Returns:
a long value
Throws:
java.io.IOException - if an error occurs
See Also:
ObjectInputStream.readLong()

readUTF

public java.lang.String readUTF()
                         throws java.io.IOException
Returns:
a String in UTF format
Throws:
java.io.IOException - if an error occurs
See Also:
ObjectInputStream.readUTF()

available

public int available()
              throws java.io.IOException
Returns:
the number of available bytes.
Throws:
java.io.IOException - if an error occurs
See Also:
ObjectInputStream.available()

getBytesRead

public long getBytesRead()
Returns:
Returns the bytesRead.

getSocket

public java.net.Socket getSocket()
Returns:
Returns the socket.

getUseCompression

public boolean getUseCompression()
Returns:
Returns the useCompression.

getDateCreated

public long getDateCreated()
Returns:
Returns the dateCreated.

getSpeed

public long getSpeed()
Returns:
Returns the speed.


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.