Top Description Fields Constructors Methods
org.hsqldb.server

pack-priv Class OdbcPacketOutputStream

extends DataOutputStream
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .DataOutputStream, .IOException

Atomic transmission packet from HyperSQL server to ODBC client. Sample usage outPacket = OdbcPacketOutputStream.newOdbcPacketOutputStream(); ... // For each packet you need to transmit: outPacket.reset(); outPacket.write(this); outPacket.write(that); outPacket.xmit('X', hsqlDataOutputStream);
Author
Blaine Simpson (blaine dot simpson at admc dot com)
Since
1.9.0

Field Summary

Modifier and TypeField and Description
private ByteArrayOutputStream
private int
private DataOutputStream
private ByteArrayOutputStream
Inherited from java.io.DataOutputStream:
written

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public synchronized void
close()

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

Closes this output stream and releases any system resources associated with the stream.

public int
pack-priv static OdbcPacketOutputStream
pack-priv synchronized void
pack-priv synchronized void
write(String s)

Wrapper method to write a null-terminated String.

pack-priv synchronized void
write(String s, boolean nullTerm)

public synchronized void
writeByteChar(char c)

The behavior here is purposefully different from java.io.DataOutputStream.writeChar(int), which writes 2 bytes.

pack-priv synchronized void
pack-priv synchronized int
xmit(char packetType, DataOutputStream destinationStream)

Returns: packet size (which does not count the type byte).

Inherited from java.io.DataOutputStream:
flushsizewritewritewriteBooleanwriteBytewriteByteswriteCharwriteCharswriteDoublewriteFloatwriteIntwriteLongwriteShortwriteUTF

Field Detail

byteArrayOutputStreamback to summary
private ByteArrayOutputStream byteArrayOutputStream
packetStartback to summary
private int packetStart
stringWriterDosback to summary
private DataOutputStream stringWriterDos
stringWriterOSback to summary
private ByteArrayOutputStream stringWriterOS

Constructor Detail

OdbcPacketOutputStreamback to summary
protected OdbcPacketOutputStream(ByteArrayOutputStream byteArrayOutputStream) throws IOException

Method Detail

closeback to summary
public synchronized void close() throws IOException

Overrides java.io.FilterOutputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.FilterOutputStream.close.

Closes this output stream and releases any system resources associated with the stream.

Exceptions
IOException:
if an I/O error occurs.
getSizeback to summary
public int getSize()
newOdbcPacketOutputStreamback to summary
pack-priv static OdbcPacketOutputStream newOdbcPacketOutputStream() throws IOException
resetback to summary
pack-priv synchronized void reset() throws IOException
writeback to summary
pack-priv synchronized void write(String s) throws IOException

Wrapper method to write a null-terminated String.

writeback to summary
pack-priv synchronized void write(String s, boolean nullTerm) throws IOException
writeByteCharback to summary
public synchronized void writeByteChar(char c) throws IOException

The behavior here is purposefully different from java.io.DataOutputStream.writeChar(int), which writes 2 bytes. We are supporting only 1-byte characters, or don't care about the high bits.

writeSizedback to summary
pack-priv synchronized void writeSized(String s) throws IOException
xmitback to summary
pack-priv synchronized int xmit(char packetType, DataOutputStream destinationStream) throws IOException
Returns:int

packet size (which does not count the type byte).