public class RequestStream
extends java.lang.Object
Implementation note:
| Modifier and Type | Field and Description | 
|---|---|
| private SharedSocket.VirtualSocket | _VirtualSocketThe unique stream id. | 
| private byte[] | bufferThe output packet buffer. | 
| private int | bufferPtrThe offset of the next byte to write. | 
| private int | bufferSizeThe current output buffer size | 
| private boolean | isClosedTrue if stream is closed. | 
| private int | maxPrecisionThe maximum decimal precision. | 
| private byte | pktTypeThe request packet type. | 
| private SharedSocket | socketThe shared network socket. | 
| Constructor and Description | 
|---|
| RequestStream(SharedSocket socket,
             SharedSocket.VirtualSocket vsock,
             int bufferSize,
             int maxPrecision)Construct a RequestStream object. | 
| Modifier and Type | Method and Description | 
|---|---|
| (package private) void | close()Close the output stream. | 
| (package private) void | flush()Flush the packet to the output stream setting the last packet flag. | 
| (package private) int | getBufferSize()Retrieve the current output packet size. | 
| (package private) byte | getMaxDecimalBytes()Returns the maximum number of bytes required to output a decimal
 given the current  maxPrecision. | 
| (package private) int | getMaxPrecision()Retrive the maximum decimal precision. | 
| (package private) int | getServerType()Retrieve the Server type. | 
| (package private) int | getTdsVersion()Retrieve the TDS version number. | 
| (package private) SharedSocket.VirtualSocket | getVirtualSocket()Retrieve the  SharedSocket.VirtualSocketused by this stream. | 
| private void | putPacket(int last)Write the TDS packet to the network. | 
| (package private) void | setBufferSize(int size)Set the output buffer size | 
| (package private) void | setPacketType(byte pktType)Set the current output packet type. | 
| (package private) void | write(java.math.BigDecimal value)Write a BigDecimal value to the output stream. | 
| (package private) void | write(byte b)Write a byte to the output stream. | 
| (package private) void | write(byte[] b)Write an array of bytes to the output stream. | 
| (package private) void | write(byte[] b,
     int off,
     int len)Write a partial byte buffer to the output stream. | 
| (package private) void | write(char[] s,
     int off,
     int len)Write a char array object to the output stream. | 
| (package private) void | write(double f)Write a double value to the output stream. | 
| (package private) void | write(float f)Write a float value to the output stream. | 
| (package private) void | write(int i)Write an int value to the output stream. | 
| (package private) void | write(long l)Write a long value to the output stream. | 
| (package private) void | write(short s)Write a short value to the output stream. | 
| (package private) void | write(java.lang.String s)Write a String object to the output stream. | 
| (package private) void | writeAscii(java.lang.String s)Write a String to the output stream as translated bytes. | 
| (package private) void | writeReaderBytes(java.io.Reader in,
                int length)Copy the contents of a Reader stream to the server as bytes. | 
| (package private) void | writeReaderChars(java.io.Reader in,
                int length)Copy the contents of a Reader stream to the server. | 
| (package private) void | writeStreamBytes(java.io.InputStream in,
                int length)Copy the contents of an InputStream to the server. | 
private final SharedSocket socket
private byte[] buffer
private int bufferPtr
private byte pktType
private final SharedSocket.VirtualSocket _VirtualSocket
private boolean isClosed
private final int bufferSize
private final int maxPrecision
RequestStream(SharedSocket socket, SharedSocket.VirtualSocket vsock, int bufferSize, int maxPrecision)
socket - the shared socket object to write tovsock - the SharedSocket.VirtualSocket used by this streambufferSize - the initial buffer size to use (the current network
    packet size)maxPrecision - the maximum precision for numeric/decimal typesvoid setBufferSize(int size)
size - The new buffer size (>= TdsCore.MIN_PKT_SIZE <= TdsCore.MAX_PKT_SIZE).int getBufferSize()
int.int getMaxPrecision()
int.byte getMaxDecimalBytes()
maxPrecision.SharedSocket.VirtualSocket getVirtualSocket()
SharedSocket.VirtualSocket used by this stream.int.void setPacketType(byte pktType)
pktType - The packet type eg TdsCore.QUERY_PKT.void write(byte b)
     throws java.io.IOException
b - The byte value to write.java.io.IOExceptionvoid write(byte[] b)
     throws java.io.IOException
b - The byte array to write.java.io.IOExceptionvoid write(byte[] b,
         int off,
         int len)
     throws java.io.IOException
b - The byte array buffer.off - The offset into the byte array.len - The number of bytes to write.java.io.IOExceptionvoid write(int i)
     throws java.io.IOException
i - The int value to write.java.io.IOExceptionvoid write(short s)
     throws java.io.IOException
s - The short value to write.java.io.IOExceptionvoid write(long l)
     throws java.io.IOException
l - The long value to write.java.io.IOExceptionvoid write(double f)
     throws java.io.IOException
f - The double value to write.java.io.IOExceptionvoid write(float f)
     throws java.io.IOException
f - The float value to write.java.io.IOExceptionvoid write(java.lang.String s)
     throws java.io.IOException
s - The String to write.java.io.IOExceptionvoid write(char[] s,
         int off,
         int len)
     throws java.io.IOException
s - The char[] to write.java.io.IOExceptionvoid writeAscii(java.lang.String s)
          throws java.io.IOException
s - The String to write.java.io.IOExceptionvoid writeStreamBytes(java.io.InputStream in,
                    int length)
                throws java.io.IOException
in - The InputStream to read.length - The length of the stream.java.io.IOExceptionvoid writeReaderChars(java.io.Reader in,
                    int length)
                throws java.io.IOException
in - The Reader object with the data.length - The length of the data in characters.java.io.IOExceptionvoid writeReaderBytes(java.io.Reader in,
                    int length)
                throws java.io.IOException
NB. Only reliable where the charset is single byte.
in - The Reader object with the data.length - The length of the data in bytes.java.io.IOExceptionvoid write(java.math.BigDecimal value)
     throws java.io.IOException
value - The BigDecimal value to write.java.io.IOExceptionvoid flush()
     throws java.io.IOException
java.io.IOExceptionvoid close()
int getTdsVersion()
int.int getServerType()
int.private void putPacket(int last)
                throws java.io.IOException
last - Set to 1 if this is the last packet else 0.java.io.IOExceptionGenerated on June 8 2013