public class ResponseStream
extends java.lang.Object
| Modifier and Type | Class and Description | 
|---|---|
| private static class  | ResponseStream.TdsInputStreamSimple inner class implementing an  InputStreamover the
 server response. | 
| Modifier and Type | Field and Description | 
|---|---|
| private SharedSocket.VirtualSocket | _VirtualSocketThe  SharedSocket.VirtualSocketused by this stream. | 
| private byte[] | bufferThe Input packet buffer. | 
| private int | bufferLenThe length of current input packet. | 
| private int | bufferPtrThe offset of the next byte to read. | 
| private byte[] | byteBufferA shared byte buffer. | 
| private char[] | charBufferA shared char buffer. | 
| private boolean | isClosedTrue if stream is closed. | 
| private SharedSocket | socketThe shared network socket. | 
| Constructor and Description | 
|---|
| ResponseStream(SharedSocket socket,
              SharedSocket.VirtualSocket vsock,
              int bufferSize)Constructs a  RequestStreamobject. | 
| Modifier and Type | Method and Description | 
|---|---|
| (package private) void | close()Closes this response stream. | 
| (package private) java.io.InputStream | getInputStream(int len)Creates a simple  InputStreamover the server response. | 
| private void | getPacket()Read the next TDS packet from the network. | 
| (package private) int | getServerType()Retrieves the server type. | 
| (package private) int | getTdsVersion()Retrieves the TDS version number. | 
| (package private) SharedSocket.VirtualSocket | getVirtualSocket()Retrieves the  SharedSocket.VirtualSocketused by this stream id. | 
| (package private) int | peek()Retrieves the next input byte without reading forward. | 
| (package private) int | read()Reads the next input byte from the server response stream. | 
| (package private) int | read(byte[] b)Reads a byte array from the server response stream. | 
| (package private) int | read(byte[] b,
    int off,
    int len)Reads a byte array from the server response stream, specifying a start
 offset and length. | 
| (package private) int | read(char[] c)Reads a char array from the server response stream. | 
| (package private) int | readInt()Reads an  intvalue from the server response stream. | 
| (package private) long | readLong()Reads a  longvalue from the server response stream. | 
| (package private) java.lang.String | readNonUnicodeString(int len)Reads a non Unicode  Stringfrom the server response stream,
 creating theStringfrom a translatedbytearray. | 
| (package private) java.lang.String | readNonUnicodeString(int len,
                    CharsetInfo charsetInfo)Reads a  Stringfrom the server response stream, translating
 it from abytearray using the specified character set. | 
| (package private) short | readShort()Reads a  shortvalue from the server response stream. | 
| (package private) java.lang.String | readString(int len)Reads a  Stringobject from the server response stream. | 
| (package private) java.lang.String | readString(int len,
          CharsetInfo info)Reads a  Stringfrom the server response stream, creating
 it from a translatedbytearray. | 
| (package private) java.lang.String | readUnicodeString(int len)Reads a UCS2-LE (Unicode) encoded String object from the server response
 stream. | 
| (package private) java.math.BigDecimal | readUnsignedLong()Reads an  unsigned longvalue from the server response stream. | 
| (package private) int | skip(int skip)Discards bytes from the server response stream. | 
| (package private) void | skipString(int len)Skips a  Stringfrom the server response stream. | 
| (package private) void | skipToEnd()Consumes the rest of the server response, without parsing it. | 
private final SharedSocket socket
private byte[] buffer
private int bufferPtr
private int bufferLen
private final SharedSocket.VirtualSocket _VirtualSocket
SharedSocket.VirtualSocket used by this stream.private boolean isClosed
private final byte[] byteBuffer
private final char[] charBuffer
ResponseStream(SharedSocket socket, SharedSocket.VirtualSocket vsock, int bufferSize)
RequestStream object.socket - the shared socket object to write tovsock - the SharedSocket.VirtualSocket used by this stream (from ResponseStream)bufferSize - the initial buffer sizeSharedSocket.VirtualSocket getVirtualSocket()
SharedSocket.VirtualSocket used by this stream id.intint peek() throws java.io.IOException
intjava.io.IOException - if an I/O error occursint read() throws java.io.IOException
intjava.io.IOException - if an I/O error occursint read(byte[] b) throws java.io.IOException
b - the byte array to read intointjava.io.IOException - if an I/O error occursint read(byte[] b,
       int off,
       int len)
   throws java.io.IOException
b - the byte arrayoff - the starting offset in the arraylen - the number of bytes to readintjava.io.IOException - if an I/O error occursint read(char[] c) throws java.io.IOException
c - the char arraybyte[]java.io.IOException - if an I/O error occursjava.lang.String readString(int len)
                      throws java.io.IOException
String object from the server response stream. If
 the TDS protocol version is 4.2 or 5.0 decode the string use the default
 server charset, otherwise use UCS2-LE (Unicode).len - the length of the string to read in bytes in the case
            of TDS 4.2/5.0 and in characters for TDS 7.0+
            (UCS2-LE encoded strings)Stringjava.io.IOException - if an I/O error occursvoid skipString(int len)
          throws java.io.IOException
String from the server response stream. If the TDS
 protocol version is 4.2 or 5.0 len is the length in bytes,
 otherwise it's the length in UCS2-LE characters (length in bytes == 2 *
 len).len - the length of the string to skip in bytes in the case
            of TDS 4.2/5.0 and in characters for TDS 7.0+
            (UCS2-LE encoded strings)java.io.IOException - if an I/O error occursjava.lang.String readUnicodeString(int len)
                             throws java.io.IOException
len - the length of the string to read in charactersStringjava.io.IOException - if an I/O error occursjava.lang.String readNonUnicodeString(int len)
                                throws java.io.IOException
String from the server response stream,
 creating the String from a translated byte
 array.len - the length of the string to read in bytesStringjava.io.IOException - if an I/O error occursjava.lang.String readNonUnicodeString(int len,
                                    CharsetInfo charsetInfo)
                                throws java.io.IOException
String from the server response stream, translating
 it from a byte array using the specified character set.len - the length of the string to read in bytesStringjava.io.IOException - if an I/O error occursjava.lang.String readString(int len,
                          CharsetInfo info)
                      throws java.io.IOException
String from the server response stream, creating
 it from a translated byte array.len - the length of the string to read in bytesinfo - descriptor of the charset to useStringjava.io.IOException - if an I/O error occursshort readShort()
          throws java.io.IOException
short value from the server response stream.shortjava.io.IOException - if an I/O error occursint readInt()
      throws java.io.IOException
int value from the server response stream.intjava.io.IOException - if an I/O error occurslong readLong()
        throws java.io.IOException
long value from the server response stream.longjava.io.IOException - if an I/O error occursjava.math.BigDecimal readUnsignedLong()
                                throws java.io.IOException
unsigned long value from the server response stream.BigDecimaljava.io.IOException - if an I/O error occursint skip(int skip) throws java.io.IOException
skip - the number of bytes to discardjava.io.IOExceptionvoid skipToEnd()
void close()
int getTdsVersion()
intint getServerType()
intjava.io.InputStream getInputStream(int len)
InputStream over the server response.
 
 This method can be used to obtain a stream which can be passed to
 InputStreamReaders to assist in reading multi byte
 character sets.len - the number of bytes available in the server responseInputStream built over the server responseprivate void getPacket()
                throws java.io.IOException
java.io.IOException - if an I/O error occursGenerated on June 8 2013