クラス org.objectweb.cjdbc.common.stream.CJDBCInputStream

すべてのメンバ一覧

説明

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.

作者:
Nicolas Modrzyk

CJDBCInputStream.java44 行で定義されています。

Public メソッド

 CJDBCInputStream (InputStream in) throws IOException, StreamCorruptedException
 CJDBCInputStream (Socket socket) throws IOException, StreamCorruptedException
Object readObject () throws ClassNotFoundException, IOException, OptionalDataException
void close () throws IOException
boolean readBoolean () throws IOException
int readInt () throws IOException
long readLong () throws IOException
String readUTF () throws IOException
int available () throws IOException
long getBytesRead ()
Socket getSocket ()
boolean getUseCompression ()
long getDateCreated ()
long getSpeed ()

Private 変数

ObjectInputStream input
long bytesRead
Socket socket
boolean useCompression = false
long speed = -1
long dateCreated


コンストラクタとデストラクタ

org.objectweb.cjdbc.common.stream.CJDBCInputStream.CJDBCInputStream InputStream  in  )  throws IOException, StreamCorruptedException
 

Creates a new CJDBCInputStream from the given input stream.

引数:
in inputstream to wrap
例外:
IOException if new ObjectInputStream() throws anException
StreamCorruptedException same as above
CJDBCInputStream.java61 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.bytesRead, と org.objectweb.cjdbc.common.stream.CJDBCInputStream.input.

00063 { 00064 input = new ObjectInputStream(new BufferedInputStream(in)); 00065 bytesRead = 0; 00066 }

org.objectweb.cjdbc.common.stream.CJDBCInputStream.CJDBCInputStream Socket  socket  )  throws IOException, StreamCorruptedException
 

Useful constructor for statistics on sockets ..

引数:
socket socket for this stream
例外:
IOException if an error occurs
StreamCorruptedException if an error occurs
CJDBCInputStream.java75 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.dateCreated, と org.objectweb.cjdbc.common.stream.CJDBCInputStream.socket.

00077 { 00078 this(socket.getInputStream()); 00079 this.socket = socket; 00080 dateCreated = System.currentTimeMillis(); 00081 }


メソッド

int org.objectweb.cjdbc.common.stream.CJDBCInputStream.available  )  throws IOException
 

参照:
java.io.ObjectInputStream#available()
戻り値:
the number of available bytes.
例外:
IOException if an error occurs
CJDBCInputStream.java182 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.input.

00183 { 00184 return input.available(); 00185 }

void org.objectweb.cjdbc.common.stream.CJDBCInputStream.close  )  throws IOException
 

参照:
java.io.ObjectInputStream#close()
例外:
IOException if an error occurs
CJDBCInputStream.java116 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.input.

参照元 org.objectweb.cjdbc.driver.ConnectionClosingThread.closeConnection().

00117 { 00118 input.close(); 00119 }

long org.objectweb.cjdbc.common.stream.CJDBCInputStream.getBytesRead  ) 
 

戻り値:
Returns the bytesRead.
CJDBCInputStream.java190 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.bytesRead.

00191 { 00192 return bytesRead; 00193 }

long org.objectweb.cjdbc.common.stream.CJDBCInputStream.getDateCreated  ) 
 

戻り値:
Returns the dateCreated.
CJDBCInputStream.java214 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.dateCreated.

00215 { 00216 return dateCreated; 00217 }

Socket org.objectweb.cjdbc.common.stream.CJDBCInputStream.getSocket  ) 
 

戻り値:
Returns the socket.
CJDBCInputStream.java198 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.socket.

00199 { 00200 return socket; 00201 }

long org.objectweb.cjdbc.common.stream.CJDBCInputStream.getSpeed  ) 
 

戻り値:
Returns the speed.
CJDBCInputStream.java222 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.speed.

00223 { 00224 return speed; 00225 }

boolean org.objectweb.cjdbc.common.stream.CJDBCInputStream.getUseCompression  ) 
 

戻り値:
Returns the useCompression.
CJDBCInputStream.java206 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.useCompression.

00207 { 00208 return useCompression; 00209 }

boolean org.objectweb.cjdbc.common.stream.CJDBCInputStream.readBoolean  )  throws IOException
 

参照:
java.io.ObjectInputStream#readBoolean()
戻り値:
a boolean value
例外:
IOException if an error occurs
CJDBCInputStream.java126 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.bytesRead, と org.objectweb.cjdbc.common.stream.CJDBCInputStream.input.

00127 { 00128 bytesRead++; 00129 return input.readBoolean(); 00130 }

int org.objectweb.cjdbc.common.stream.CJDBCInputStream.readInt  )  throws IOException
 

参照:
java.io.ObjectInputStream#readInt()
戻り値:
an int value
例外:
IOException if an error occurs
CJDBCInputStream.java137 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.bytesRead, と org.objectweb.cjdbc.common.stream.CJDBCInputStream.input.

参照元 org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run().

00138 { 00139 bytesRead += 4; 00140 return input.readInt(); 00141 }

long org.objectweb.cjdbc.common.stream.CJDBCInputStream.readLong  )  throws IOException
 

参照:
java.io.ObjectInputStream#readLong()
戻り値:
a long value
例外:
IOException if an error occurs
CJDBCInputStream.java148 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.bytesRead, と org.objectweb.cjdbc.common.stream.CJDBCInputStream.input.

00149 { 00150 bytesRead += 8; 00151 return input.readLong(); 00152 }

Object org.objectweb.cjdbc.common.stream.CJDBCInputStream.readObject  )  throws ClassNotFoundException, IOException, OptionalDataException
 

戻り値:
the Object read from the stream
例外:
ClassNotFoundException if an error occurs
IOException if an error occurs
OptionalDataException if an error occurs
参照:
java.io.ObjectInputStream#readObject()
CJDBCInputStream.java90 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.bytesRead, org.objectweb.cjdbc.common.stream.CJDBCInputStream.input, と org.objectweb.cjdbc.common.stream.CJDBCInputStream.useCompression.

参照元 org.objectweb.cjdbc.driver.ConnectionClosingThread.closeConnection(), と org.objectweb.cjdbc.driver.Driver.connect().

00092 { 00093 if (useCompression) 00094 { 00095 int len = input.readInt(); 00096 byte[] read = new byte[len]; 00097 input.readFully(read); 00098 00099 bytesRead += len + 4; 00100 // we read an integer in the pipe for the size of the array. 00101 return CJDBCStream.decompressObject(read); 00102 } 00103 else 00104 { 00105 // Use the unshared version to prevent the stream to keep references on 00106 // objects. This prevents objects sent through the channel from being 00107 // garbage collected and results in memory leaks. 00108 return input.readUnshared(); 00109 } 00110 }

String org.objectweb.cjdbc.common.stream.CJDBCInputStream.readUTF  )  throws IOException
 

参照:
java.io.ObjectInputStream#readUTF()
戻り値:
a String in UTF format
例外:
IOException if an error occurs
CJDBCInputStream.java159 行で定義されています。

参照先 org.objectweb.cjdbc.common.stream.CJDBCInputStream.bytesRead.

参照元 org.objectweb.cjdbc.driver.Driver.connect(), と org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run().

00160 { 00161 try 00162 { 00163 Object read = this.readObject(); 00164 if (read == null) 00165 return null; 00166 bytesRead += ((String) read).length(); 00167 return (String) read; 00168 } 00169 catch (ClassNotFoundException e) 00170 { 00171 // It's a string so that should never happen ... 00172 // but just to be sure 00173 throw new IOException(e.getMessage()); 00174 } 00175 }


変数

long org.objectweb.cjdbc.common.stream.CJDBCInputStream.bytesRead [private]
 

CJDBCInputStream.java47 行で定義されています。

参照元 org.objectweb.cjdbc.common.stream.CJDBCInputStream.CJDBCInputStream(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.getBytesRead(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.readBoolean(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.readInt(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.readLong(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.readObject(), と org.objectweb.cjdbc.common.stream.CJDBCInputStream.readUTF().

long org.objectweb.cjdbc.common.stream.CJDBCInputStream.dateCreated [private]
 

CJDBCInputStream.java51 行で定義されています。

参照元 org.objectweb.cjdbc.common.stream.CJDBCInputStream.CJDBCInputStream(), と org.objectweb.cjdbc.common.stream.CJDBCInputStream.getDateCreated().

ObjectInputStream org.objectweb.cjdbc.common.stream.CJDBCInputStream.input [private]
 

CJDBCInputStream.java46 行で定義されています。

参照元 org.objectweb.cjdbc.common.stream.CJDBCInputStream.available(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.CJDBCInputStream(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.close(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.readBoolean(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.readInt(), org.objectweb.cjdbc.common.stream.CJDBCInputStream.readLong(), と org.objectweb.cjdbc.common.stream.CJDBCInputStream.readObject().

Socket org.objectweb.cjdbc.common.stream.CJDBCInputStream.socket [private]
 

CJDBCInputStream.java48 行で定義されています。

参照元 org.objectweb.cjdbc.common.stream.CJDBCInputStream.CJDBCInputStream(), と org.objectweb.cjdbc.common.stream.CJDBCInputStream.getSocket().

long org.objectweb.cjdbc.common.stream.CJDBCInputStream.speed = -1 [private]
 

CJDBCInputStream.java50 行で定義されています。

参照元 org.objectweb.cjdbc.common.stream.CJDBCInputStream.getSpeed().

boolean org.objectweb.cjdbc.common.stream.CJDBCInputStream.useCompression = false [private]
 

CJDBCInputStream.java49 行で定義されています。

参照元 org.objectweb.cjdbc.common.stream.CJDBCInputStream.getUseCompression(), と org.objectweb.cjdbc.common.stream.CJDBCInputStream.readObject().


このクラスの説明は次のファイルから生成されました:
CJDBCversion1.0.4に対してTue Oct 12 15:16:19 2004に生成されました。 doxygen 1.3.8