Public Member Functions | |
CJDBCOutputStream (Socket socket) throws IOException, StreamCorruptedException | |
CJDBCOutputStream (OutputStream out) throws IOException, StreamCorruptedException | |
void | flush () throws IOException |
void | close () throws IOException |
void | writeObject (Object obj) throws IOException |
void | writeUTF (String string) throws IOException |
void | writeInt (int value) throws IOException |
void | writeLong (long value) throws IOException |
void | writeBoolean (boolean value) throws IOException |
long | getBytesWritten () |
Socket | getSocket () |
long | getDateCreated () |
boolean | getUseCompression () |
long | getSpeed () |
Definition at line 42 of file CJDBCOutputStream.java.
|
Creates a new
Definition at line 71 of file CJDBCOutputStream.java. 00073 { 00074 this(socket.getOutputStream()); 00075 this.socket = socket; 00076 }
|
|
Creates a new CJDBCOutputStream from the given input stream.
Definition at line 86 of file CJDBCOutputStream.java. 00088 { 00089 output = new ObjectOutputStream(new BufferedOutputStream(out)); 00090 dateCreated = System.currentTimeMillis(); 00091 bytesWritten = 0; 00092 }
|
|
Definition at line 107 of file CJDBCOutputStream.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.shutdown(). 00108 { 00109 output.close(); 00110 }
|
|
Definition at line 98 of file CJDBCOutputStream.java. Referenced by org.objectweb.cjdbc.driver.Driver.connect(), org.objectweb.cjdbc.driver.Connection.execReadStoredProcedure(), org.objectweb.cjdbc.driver.Connection.execWriteRequestWithKeys(), org.objectweb.cjdbc.driver.Connection.execWriteStoredProcedure(), org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(), and org.objectweb.cjdbc.controller.core.ControllerServerThread.run(). 00099 { 00100 output.flush(); 00101 }
|
|
Definition at line 234 of file CJDBCOutputStream.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.getBytesWritten(). 00235 {
00236 return bytesWritten;
00237 }
|
|
Definition at line 250 of file CJDBCOutputStream.java. 00251 {
00252 return dateCreated;
00253 }
|
|
Definition at line 242 of file CJDBCOutputStream.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.retrieveClientData(). 00243 {
00244 return socket;
00245 }
|
|
Definition at line 266 of file CJDBCOutputStream.java. Referenced by org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.getReadingSpeed(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabaseWorkerThread.getWritingSpeed(). 00267 {
00268 return speed;
00269 }
|
|
Definition at line 258 of file CJDBCOutputStream.java. 00259 {
00260 return useCompression;
00261 }
|
|
Definition at line 225 of file CJDBCOutputStream.java. 00226 { 00227 bytesWritten += 1; 00228 output.writeBoolean(value); 00229 }
|
|
Definition at line 203 of file CJDBCOutputStream.java. Referenced by org.objectweb.cjdbc.driver.Driver.connect(), org.objectweb.cjdbc.driver.Connection.execReadStoredProcedure(), org.objectweb.cjdbc.driver.Connection.execWriteRequestWithKeys(), and org.objectweb.cjdbc.driver.Connection.execWriteStoredProcedure(). 00204 { 00205 bytesWritten += 4; 00206 output.writeInt(value); 00207 }
|
|
Definition at line 214 of file CJDBCOutputStream.java. 00215 { 00216 bytesWritten += 8; 00217 output.writeLong(value); 00218 }
|
|
Definition at line 117 of file CJDBCOutputStream.java. Referenced by org.objectweb.cjdbc.controller.core.ControllerWorkerThread.run(), and org.objectweb.cjdbc.controller.core.ControllerServerThread.run(). 00118 { 00119 if (useCompression) 00120 { 00121 byte[] bytes = CJDBCStream.compressObject(obj); 00122 bytesWritten += bytes.length + 4; 00123 // we are sending an integer on the pipe. 00124 00125 output.writeInt(bytes.length); 00126 output.write(bytes); 00127 } 00128 else 00129 { 00130 if (obj == null) 00131 { 00132 output.writeInt(CJDBCStream.NULL); 00133 return; 00134 } 00135 else if (obj instanceof String) 00136 { 00137 String str = (String) obj; 00138 if (str.length() < MAXIMUM_STRING_LENGTH_IN_WRITEUTF) 00139 { // If the String can fit for a writeUTF call then use it else defaults 00140 // to writeUnshared (below) that will call the appropriate method to 00141 // send longer strings (not publicly available in the API). 00142 output.writeInt(CJDBCStream.STRING_OBJECT); 00143 output.writeUTF(str); 00144 return; 00145 } 00146 } 00147 else if (obj instanceof Integer) 00148 { 00149 output.writeInt(CJDBCStream.INTEGER_OBJECT); 00150 output.writeInt(((Integer) obj).intValue()); 00151 return; 00152 } 00153 else if (obj instanceof Long) 00154 { 00155 output.writeInt(CJDBCStream.LONG_OBJECT); 00156 output.writeLong(((Long) obj).longValue()); 00157 return; 00158 } 00159 else if (obj instanceof Boolean) 00160 { 00161 output.writeInt(CJDBCStream.BOOLEAN_OBJECT); 00162 output.writeBoolean(((Boolean) obj).booleanValue()); 00163 return; 00164 } 00165 00166 // Here we have an object for which we don't have special optimization and 00167 // that we will send as an object 00168 output.writeInt(CJDBCStream.OBJECT); 00169 00170 // Use the unshared version to prevent the stream to keep references on 00171 // objects. This prevents objects sent through the channel from being 00172 // garbage collected and results in memory leaks. 00173 output.writeUnshared(obj); 00174 00175 if (obj instanceof ArrayList) 00176 { // Reset the stream for shallow copies since unshared does not handle 00177 // them. 00178 output.flush(); 00179 output.reset(); 00180 } 00181 } 00182 00183 }
|
|
Definition at line 190 of file CJDBCOutputStream.java. Referenced by org.objectweb.cjdbc.driver.Driver.connect(). 00191 { 00192 // Let writeObject handle this in case string is null 00193 this.writeObject(string); 00194 if (string != null) 00195 bytesWritten += string.length(); 00196 }
|