Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.mysql.jdbc
Class Buffer  view Buffer download Buffer.java

java.lang.Object
  extended bycom.mysql.jdbc.Buffer

class Buffer
extends java.lang.Object

Buffer contains code to read and write packets from/to the MySQL server.

Version:
$Id: Buffer.java,v 1.15.2.18 2004/10/21 19:31:04 mmatthew Exp $

Field Summary
private  int bufLength
           
private  byte[] byteBuffer
           
(package private) static int NO_LENGTH_LIMIT
           
(package private) static long NULL_LENGTH
           
private  int position
           
private  int sendLength
           
private  boolean wasMultiPacket
           
 
Constructor Summary
(package private) Buffer(byte[] buf)
           
(package private) Buffer(int size)
           
 
Method Summary
(package private)  void clear()
           
(package private)  void dump()
           
(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
protected  byte[] getBufferSource()
           
(package private)  int getBufLength()
           
 byte[] getByteBuffer()
          Returns the array of bytes this Buffer is using to read from.
(package private)  byte[] getBytes(int len)
           
 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)  long readFieldLength()
           
(package private)  int readInt()
           
(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 bufLength)
           
 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
(package private)  void setSendLength(int sendLength)
           
 void setWasMultiPacket(boolean flag)
          Sets whether this packet was part of a multipacket
 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 writeFloat(float f)
           
(package private)  void writeInt(int i)
           
(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, SingleByteCharsetConverter converter, boolean parserKnowsUnicode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_LENGTH_LIMIT

static final int NO_LENGTH_LIMIT
See Also:
Constant Field Values

NULL_LENGTH

static final long NULL_LENGTH
See Also:
Constant Field Values

byteBuffer

private byte[] byteBuffer

wasMultiPacket

private boolean wasMultiPacket

bufLength

private int bufLength

position

private int position

sendLength

private int sendLength
Constructor Detail

Buffer

Buffer(byte[] buf)

Buffer

Buffer(int size)
Method Detail

setByteBuffer

public void setByteBuffer(byte[] byteBuffer)
Sets the array of bytes to use as a buffer to read from.


getByteBuffer

public byte[] getByteBuffer()
Returns the array of bytes this Buffer is using to read from.


setPosition

public void setPosition(int position)
Set the current position to write to/ read from


getPosition

public int getPosition()
Returns the current position to write to/ read from


setWasMultiPacket

public void setWasMultiPacket(boolean flag)
Sets whether this packet was part of a multipacket


fastSkipLenString

public int fastSkipLenString()
Skip over a length-encoded string


wasMultiPacket

public boolean wasMultiPacket()
Was this packet part of a multipacket?


getBufferSource

protected final byte[] getBufferSource()

getBytes

final byte[] getBytes(int len)

isLastDataPacket

final boolean isLastDataPacket()

clear

final void clear()

dump

final void dump()

dumpHeader

final void dumpHeader()

dumpNBytes

final void dumpNBytes(int start,
                      int nBytes)

ensureCapacity

final void ensureCapacity(int additionalData)
                   throws java.sql.SQLException

newReadLength

final long newReadLength()

readByte

final byte readByte()

readFieldLength

final long readFieldLength()

readInt

final int readInt()

readLenByteArray

final byte[] readLenByteArray(int offset)

readLength

final long readLength()

readLong

final long readLong()

readLongInt

final int readLongInt()

readLongLong

final long readLongLong()

readString

final java.lang.String readString()

readString

final java.lang.String readString(java.lang.String encoding)
                           throws java.sql.SQLException

readnBytes

final int readnBytes()

writeByte

final void writeByte(byte b)
              throws java.sql.SQLException

writeBytesNoNull

final void writeBytesNoNull(byte[] bytes)
                     throws java.sql.SQLException

writeBytesNoNull

final void writeBytesNoNull(byte[] bytes,
                            int offset,
                            int length)
                     throws java.sql.SQLException

writeDouble

final void writeDouble(double d)

writeFloat

final void writeFloat(float f)

writeInt

final void writeInt(int i)

writeLong

final void writeLong(long i)

writeLongInt

final void writeLongInt(int i)

writeLongLong

final void writeLongLong(long i)

writeString

final void writeString(java.lang.String s)
                throws java.sql.SQLException

writeStringNoNull

final void writeStringNoNull(java.lang.String s)
                      throws java.sql.SQLException

writeStringNoNull

final void writeStringNoNull(java.lang.String s,
                             java.lang.String encoding,
                             java.lang.String serverEncoding,
                             SingleByteCharsetConverter converter,
                             boolean parserKnowsUnicode)
                      throws java.io.UnsupportedEncodingException,
                             java.sql.SQLException

setBufLength

void setBufLength(int bufLength)

getBufLength

int getBufLength()

setSendLength

void setSendLength(int sendLength)