|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mysql.jdbc.Buffer
com.mysql.jdbc.ChannelBuffer
Buffer contains code to read and write packets from/to the MySQL server.
Field Summary | |
(package private) static int |
MAX_BYTES_TO_DUMP
|
(package private) static int |
NO_LENGTH_LIMIT
|
(package private) static long |
NULL_LENGTH
|
protected boolean |
wasMultiPacket
|
Constructor Summary | |
(package private) |
ChannelBuffer(byte[] buf)
|
(package private) |
ChannelBuffer(int size,
boolean direct)
|
Method Summary | |
static Buffer |
allocateDirect(int size,
boolean useNewIo)
|
static Buffer |
allocateNew(byte[] buf,
boolean useNewIo)
|
static Buffer |
allocateNew(int size,
boolean useNewIo)
|
(package private) void |
clear()
|
(package private) void |
dump()
|
(package private) java.lang.String |
dump(int numBytes)
|
(package private) java.lang.String |
dumpClampedBytes(int numBytes)
|
(package private) void |
dumpHeader()
|
(package private) void |
dumpNBytes(int start,
int nBytes)
|
(package private) void |
ensureCapacity(int additionalData)
|
int |
fastSkipLenString()
Skip over a length-encoded string |
(package private) int |
getBufLength()
|
byte[] |
getByteBuffer()
Returns the array of bytes this Buffer is using to read from. |
(package private) byte[] |
getBytes(int len)
|
(package private) byte[] |
getBytes(int offset,
int len)
|
(package private) int |
getCapacity()
|
java.nio.ByteBuffer |
getNioBuffer()
Returns the Java NIO Buffer (if any) |
int |
getPosition()
Returns the current position to write to/ read from |
(package private) boolean |
isLastDataPacket()
|
(package private) long |
newReadLength()
|
(package private) byte |
readByte()
|
(package private) byte |
readByte(int readAt)
|
(package private) long |
readFieldLength()
|
(package private) int |
readInt()
|
(package private) int |
readIntAsLong()
|
(package private) byte[] |
readLenByteArray(int offset)
|
(package private) long |
readLength()
|
(package private) long |
readLong()
|
(package private) int |
readLongInt()
|
(package private) long |
readLongLong()
|
(package private) int |
readnBytes()
|
(package private) java.lang.String |
readString()
|
(package private) java.lang.String |
readString(java.lang.String encoding)
|
(package private) void |
setBufLength(int bufLengthToSet)
|
void |
setByteBuffer(byte[] byteBuffer)
Sets the array of bytes to use as a buffer to read from. |
void |
setPosition(int position)
Set the current position to write to/ read from |
void |
setWasMultiPacket(boolean flag)
Sets whether this packet was part of a multipacket |
java.lang.String |
toString()
|
java.lang.String |
toSuperString()
|
boolean |
wasMultiPacket()
Was this packet part of a multipacket? |
(package private) void |
writeByte(byte b)
|
(package private) void |
writeBytesNoNull(byte[] bytes)
|
(package private) void |
writeBytesNoNull(byte[] bytes,
int offset,
int length)
|
(package private) void |
writeDouble(double d)
|
(package private) void |
writeFieldLength(long length)
|
(package private) void |
writeFloat(float f)
|
(package private) void |
writeInt(int i)
|
(package private) void |
writeLenBytes(byte[] b)
|
(package private) void |
writeLenString(java.lang.String s,
java.lang.String encoding,
java.lang.String serverEncoding,
SingleByteCharsetConverter converter,
boolean parserKnowsUnicode)
|
(package private) void |
writeLong(long i)
|
(package private) void |
writeLongInt(int i)
|
(package private) void |
writeLongLong(long i)
|
(package private) void |
writeString(java.lang.String s)
|
(package private) void |
writeStringNoNull(java.lang.String s)
|
(package private) void |
writeStringNoNull(java.lang.String s,
java.lang.String encoding,
java.lang.String serverEncoding,
boolean parserKnowsUnicode)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final int MAX_BYTES_TO_DUMP
static final int NO_LENGTH_LIMIT
static final long NULL_LENGTH
protected boolean wasMultiPacket
Constructor Detail |
ChannelBuffer(byte[] buf)
ChannelBuffer(int size, boolean direct)
Method Detail |
final void clear()
clear
in class Buffer
final void ensureCapacity(int additionalData) throws java.sql.SQLException
ensureCapacity
in class Buffer
java.sql.SQLException
public int fastSkipLenString()
fastSkipLenString
in class Buffer
int getBufLength()
getBufLength
in class Buffer
public byte[] getByteBuffer()
getByteBuffer
in class Buffer
final byte[] getBytes(int len)
getBytes
in class Buffer
byte[] getBytes(int offset, int len)
getBytes
in class Buffer
int getCapacity()
getCapacity
in class Buffer
public java.nio.ByteBuffer getNioBuffer()
Buffer
getNioBuffer
in class Buffer
public int getPosition()
getPosition
in class Buffer
final boolean isLastDataPacket()
isLastDataPacket
in class Buffer
final long newReadLength()
newReadLength
in class Buffer
final byte readByte()
readByte
in class Buffer
final byte readByte(int readAt)
readByte
in class Buffer
final long readFieldLength()
readFieldLength
in class Buffer
final int readInt()
readInt
in class Buffer
final int readIntAsLong()
readIntAsLong
in class Buffer
final byte[] readLenByteArray(int offset)
readLenByteArray
in class Buffer
final long readLength()
readLength
in class Buffer
final long readLong()
readLong
in class Buffer
final int readLongInt()
readLongInt
in class Buffer
final long readLongLong()
readLongLong
in class Buffer
final int readnBytes()
readnBytes
in class Buffer
final java.lang.String readString()
readString
in class Buffer
final java.lang.String readString(java.lang.String encoding) throws java.sql.SQLException
readString
in class Buffer
java.sql.SQLException
void setBufLength(int bufLengthToSet)
setBufLength
in class Buffer
public void setByteBuffer(byte[] byteBuffer)
setByteBuffer
in class Buffer
byteBuffer
- the array of bytes to use as a bufferpublic void setPosition(int position)
setPosition
in class Buffer
position
- the position (0-based index)final void writeByte(byte b) throws java.sql.SQLException
writeByte
in class Buffer
java.sql.SQLException
final void writeBytesNoNull(byte[] bytes) throws java.sql.SQLException
writeBytesNoNull
in class Buffer
java.sql.SQLException
final void writeBytesNoNull(byte[] bytes, int offset, int length) throws java.sql.SQLException
writeBytesNoNull
in class Buffer
java.sql.SQLException
final void writeDouble(double d) throws java.sql.SQLException
writeDouble
in class Buffer
java.sql.SQLException
final void writeFieldLength(long length) throws java.sql.SQLException
writeFieldLength
in class Buffer
java.sql.SQLException
final void writeFloat(float f) throws java.sql.SQLException
writeFloat
in class Buffer
java.sql.SQLException
final void writeInt(int i) throws java.sql.SQLException
writeInt
in class Buffer
java.sql.SQLException
final void writeLenBytes(byte[] b) throws java.sql.SQLException
writeLenBytes
in class Buffer
java.sql.SQLException
final void writeLenString(java.lang.String s, java.lang.String encoding, java.lang.String serverEncoding, SingleByteCharsetConverter converter, boolean parserKnowsUnicode) throws java.io.UnsupportedEncodingException, java.sql.SQLException
writeLenString
in class Buffer
java.io.UnsupportedEncodingException
java.sql.SQLException
final void writeLong(long i) throws java.sql.SQLException
writeLong
in class Buffer
java.sql.SQLException
final void writeLongInt(int i) throws java.sql.SQLException
writeLongInt
in class Buffer
java.sql.SQLException
final void writeLongLong(long i) throws java.sql.SQLException
writeLongLong
in class Buffer
java.sql.SQLException
final void writeString(java.lang.String s) throws java.sql.SQLException
writeString
in class Buffer
java.sql.SQLException
final void writeStringNoNull(java.lang.String s) throws java.sql.SQLException
writeStringNoNull
in class Buffer
java.sql.SQLException
final void writeStringNoNull(java.lang.String s, java.lang.String encoding, java.lang.String serverEncoding, boolean parserKnowsUnicode) throws java.io.UnsupportedEncodingException, java.sql.SQLException
writeStringNoNull
in class Buffer
java.io.UnsupportedEncodingException
java.sql.SQLException
public static Buffer allocateDirect(int size, boolean useNewIo)
public static Buffer allocateNew(byte[] buf, boolean useNewIo)
public static Buffer allocateNew(int size, boolean useNewIo)
final void dump()
final java.lang.String dump(int numBytes)
final java.lang.String dumpClampedBytes(int numBytes)
final void dumpHeader()
final void dumpNBytes(int start, int nBytes)
public void setWasMultiPacket(boolean flag)
flag
- was this packet part of a multipacket?public java.lang.String toString()
public java.lang.String toSuperString()
public boolean wasMultiPacket()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |