|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--net.sourceforge.jtds.jdbc.ResponseStream
Class to implement an input stream for the server response.
Implementation note:
| Field Summary | |
private byte[] |
buffer
The Input packet buffer. |
private int |
bufferLen
The length of current input packet. |
private int |
bufferPtr
The offset of the next byte to read. |
private byte[] |
byteBuffer
A shared byte buffer. |
private char[] |
charBuffer
A shared char buffer. |
private boolean |
isClosed
True if stream is closed. |
private SharedSocket |
socket
The shared network socket. |
private int |
streamId
The unique stream id. |
| Constructor Summary | |
(package private) |
ResponseStream(SharedSocket socket,
int streamId,
int bufferSize)
Construct a RequestStream object. |
| Method Summary | |
(package private) void |
close()
Close this response stream. |
private void |
getPacket()
Read the next TDS packet from the network. |
(package private) int |
getServerType()
Retrieve the Server type. |
(package private) int |
getStreamId()
Retrieve the unique stream id. |
(package private) int |
getTdsVersion()
Retrieve the TDS version number. |
(package private) int |
peek()
Retrieve the next input byte without reading forward. |
(package private) int |
read()
Retrieve the next input byte from the server response stream. |
(package private) int |
read(byte[] b)
Retrieve a byte array from the server response stream. |
(package private) int |
read(byte[] b,
int off,
int len)
Retrieve a byte array from the server response stream, specifying a start offset and length. |
(package private) int |
read(char[] c)
Retrieve a char array from the server response stream. |
(package private) int |
readInt()
Retrieve an int value from the server response stream. |
(package private) long |
readLong()
Retrieve a long value from the server response stream. |
(package private) java.lang.String |
readNonUnicodeString(int len)
Retrieve a String object from the server response stream, creating the string from a translated byte array. |
(package private) java.lang.String |
readNonUnicodeString(int len,
CharsetInfo charsetInfo)
Retrieve a String object from the server response stream, translating it from a byte array using the specified character set. |
(package private) short |
readShort()
Retrieve a short value from the server response stream. |
(package private) java.lang.String |
readString(int len)
Retrieve a String object from the server response stream. |
(package private) java.lang.String |
readString(int len,
CharsetInfo info)
Retrieve a String object from the server response stream, creating the string from a translated byte array. |
(package private) java.lang.String |
readUnicodeString(int len)
Retrieve a UCS2-LE (Unicode) encoded String object from the server response stream. |
(package private) int |
skip(int skip)
Discard bytes from the server response stream. |
(package private) void |
skipString(int len)
Skip a string from the server response stream. |
(package private) void |
skipToEnd()
Consumes the rest of the server response, without parsing it. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private SharedSocket socket
private byte[] buffer
private int bufferPtr
private int bufferLen
private int streamId
private boolean isClosed
private byte[] byteBuffer
private char[] charBuffer
| Constructor Detail |
ResponseStream(SharedSocket socket,
int streamId,
int bufferSize)
socket - The shared socket object to write to.streamId - The unique id for this stream (from ResponseStream).| Method Detail |
int getStreamId()
int.int peek() throws java.io.IOException
int.java.io.IOException - int read() throws java.io.IOException
int.java.io.IOException - int read(byte[] b) throws java.io.IOException
b - The byte array.int.java.io.IOException -
int read(byte[] b,
int off,
int len)
throws java.io.IOException
b - The byte array.off - The starting offset in the array.len - The number of bytes to read.int.java.io.IOException - int read(char[] c) throws java.io.IOException
c - The char array.byte[].java.io.IOException -
java.lang.String readString(int len)
throws java.io.IOException
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 occurs
void skipString(int len)
throws java.io.IOException
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 occurs
java.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 occurs
java.lang.String readNonUnicodeString(int len)
throws java.io.IOException
len - the length of the string to read in bytesStringjava.io.IOException - if an I/O error occurs
java.lang.String readNonUnicodeString(int len,
CharsetInfo charsetInfo)
throws java.io.IOException
len - the length of the string to read in bytesStringjava.io.IOException - if an I/O error occurs
java.lang.String readString(int len,
CharsetInfo info)
throws java.io.IOException
len - the length of the string to read in bytesinfo - descriptor of the charset to useStringjava.io.IOException - if an I/O error occurs
short readShort()
throws java.io.IOException
short.java.io.IOException -
int readInt()
throws java.io.IOException
int.java.io.IOException -
long readLong()
throws java.io.IOException
long.java.io.IOException - int skip(int skip) throws java.io.IOException
skip - The number of bytes to discard.int.void skipToEnd()
void close()
int getTdsVersion()
int.int getServerType()
int.
private void getPacket()
throws java.io.IOException
java.io.IOException -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||