|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.cjdbc.common.stream.CJDBCOutputStream
DataOutputStream wrapper used between the controller and the driver.
CJDBCStream
Field Summary | |
private long |
dateCreated
|
private java.io.DataOutputStream |
output
|
private java.net.Socket |
socket
|
Constructor Summary | |
CJDBCOutputStream(java.io.OutputStream out)
Creates a new CJDBCOutputStream from the given input stream. |
|
CJDBCOutputStream(java.net.Socket socket)
Creates a new CJDBCOutputStream object for statistics on
sockets |
Method Summary | |
void |
close()
|
void |
flush()
|
long |
getDateCreated()
|
java.net.Socket |
getSocket()
|
void |
write(byte[] b)
|
void |
write(byte[] b,
int offset,
int length)
|
void |
writeBoolean(boolean value)
|
void |
writeDouble(double value)
|
void |
writeFloat(float value)
|
void |
writeInt(int value)
|
void |
writeLong(long value)
|
void |
writeUTF(java.lang.String string)
We split the String into 21K-long chunks and encode+send them one after the other. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.io.DataOutputStream output
private java.net.Socket socket
private long dateCreated
Constructor Detail |
public CJDBCOutputStream(java.net.Socket socket) throws java.io.IOException
CJDBCOutputStream
object for statistics on
sockets
socket
- socket to monitor
java.io.IOException
- if an IO error occurspublic CJDBCOutputStream(java.io.OutputStream out)
out
- outputstream to wrapMethod Detail |
public void flush() throws java.io.IOException
java.io.IOException
- if an error occursDataOutputStream.flush()
public void close() throws java.io.IOException
java.io.IOException
- if an error occursFilterOutputStream.close()
public void writeUTF(java.lang.String string) throws java.io.IOException
Java's writeUTF() is fully specified in
DataOutput.writeUTF(java.lang.String)
and stable since
JDK1.0. Implementation is located in
DataOutputStream.writeUTF(java.lang.String,
java.io.DataOutput)
At first this looks like a kludge but: (1) On one hand it's almost required anyway to split into chunks (whatever technique we choose) since strings can be infinitely long and we don't want to allocate tons of memory. (2) On the other hand it is hard to find out a String serialization which is both efficient and based upon a standard encoding. Let's briefly look at the alternatives:
string
- a String to write in UTF form to the stream
java.io.IOException
- if an error occursDataOutputStream.writeUTF(java.lang.String)
public void writeInt(int value) throws java.io.IOException
value
- an int value to write to the stream
java.io.IOException
- if an error occursDataOutputStream.writeInt(int)
public void writeLong(long value) throws java.io.IOException
value
- a long value to write to the stream
java.io.IOException
- if an error occursDataOutputStream.writeLong(long)
public void writeFloat(float value) throws java.io.IOException
value
- a float value to write to the stream
java.io.IOException
- if an error occursDataOutputStream.writeFloat(float)
public void writeDouble(double value) throws java.io.IOException
value
- a double value to write to the stream
java.io.IOException
- if an error occursDataOutputStream.writeDouble(double)
public void write(byte[] b) throws java.io.IOException
b
- an array of bytes to write to the stream
java.io.IOException
- if an error occursFilterOutputStream.write(byte[])
public void write(byte[] b, int offset, int length) throws java.io.IOException
java.io.IOException
DataOutputStream.write(byte[], int, int)
public void writeBoolean(boolean value) throws java.io.IOException
value
- a boolean value to write to the stream
java.io.IOException
- if an error occursDataOutputStream.writeBoolean(boolean)
public java.net.Socket getSocket()
public long getDateCreated()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |