Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mysql.jdbc
Class Buffer

    java.lang.Object
      com.mysql.jdbc.Buffer

    public class Buffer

extends java.lang.Object

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
`Buffer(byte[] buf)`
`Buffer(int size)`

Method Summary
`(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)`
`void` | `fastSkipLenByteArray()`
`int` | `fastSkipLenString()` Skip over a length-encoded string
`protected byte[]` | `getBufferSource()`
`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()`
`int` | `getPosition()` Returns the current position to write to/ read from
`(package private) boolean` | `isAuthMethodSwitchRequestPacket()`
`(package private) boolean` | `isLastDataPacket()`
`(package private) boolean` | `isOKPacket()`
`(package private) boolean` | `isRawPacket()`
`(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()`
`java.lang.String` | `readString()`
`(package private) java.lang.String` | `readString(java.lang.String encoding, ExceptionInterceptor exceptionInterceptor)`
`(package private) java.lang.String` | `readString(java.lang.String encoding, ExceptionInterceptor exceptionInterceptor, int expectedLength)` Read a fixed length string
`void` | `setBufLength(int bufLengthToSet)`
`void` | `setByteBuffer(byte[] byteBufferToSet)` Sets the array of bytes to use as a buffer to read from.
`void` | `setPosition(int positionToSet)` 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?
`void` | `writeByte(byte b)`
`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, MySQLConnection conn)`
`(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` | `writeString(java.lang.String s, java.lang.String encoding, MySQLConnection conn)`
`(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, MySQLConnection conn)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### MAX_BYTES_TO_DUMP

    static final int MAX_BYTES_TO_DUMP

See Also:
  Constant Field Values

### 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

### wasMultiPacket

    protected boolean wasMultiPacket

Constructor Detail

### Buffer

    public Buffer(byte[] buf)

### Buffer

    Buffer(int size)

Method Detail

### clear

    final void clear()

### dump

    final void dump()

### dump

    final java.lang.String dump(int numBytes)

### dumpClampedBytes

    final java.lang.String dumpClampedBytes(int numBytes)

### dumpHeader

    final void dumpHeader()

### dumpNBytes

    final void dumpNBytes(int start,
                          int nBytes)

### ensureCapacity

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

  Throws:
    `java.sql.SQLException`

### fastSkipLenString

    public int fastSkipLenString()

  Skip over a length-encoded string

  Returns:
    The position past the end of the string

### fastSkipLenByteArray

    public void fastSkipLenByteArray()

### getBufferSource

    protected final byte[] getBufferSource()

### getBufLength

    public int getBufLength()

### getByteBuffer

    public byte[] getByteBuffer()

  Returns the array of bytes this Buffer is using to read from.

  Returns:
    byte array being read from

### getBytes

    final byte[] getBytes(int len)

### getBytes

    byte[] getBytes(int offset,
                    int len)

### getCapacity

    int getCapacity()

### getNioBuffer

    public java.nio.ByteBuffer getNioBuffer()

### getPosition

    public int getPosition()

  Returns the current position to write to/ read from

  Returns:
    the current position to write to/ read from

### isLastDataPacket

    final boolean isLastDataPacket()

### isAuthMethodSwitchRequestPacket

    final boolean isAuthMethodSwitchRequestPacket()

### isOKPacket

    final boolean isOKPacket()

### isRawPacket

    final boolean isRawPacket()

### newReadLength

    final long newReadLength()

### readByte

    final byte readByte()

### readByte

    final byte readByte(int readAt)

### readFieldLength

    final long readFieldLength()

### readInt

    final int readInt()

### readIntAsLong

    final int readIntAsLong()

### readLenByteArray

    final byte[] readLenByteArray(int offset)

### readLength

    final long readLength()

### readLong

    final long readLong()

### readLongInt

    final int readLongInt()

### readLongLong

    final long readLongLong()

### readnBytes

    final int readnBytes()

### readString

    public final java.lang.String readString()

### readString

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

  Throws:
    `java.sql.SQLException`

### readString

    final java.lang.String readString(java.lang.String encoding,
                                      ExceptionInterceptor exceptionInterceptor,
                                      int expectedLength)
                               throws java.sql.SQLException

  Read a fixed length string

  Throws:
    `java.sql.SQLException`

### setBufLength

    public void setBufLength(int bufLengthToSet)

### setByteBuffer

    public void setByteBuffer(byte[] byteBufferToSet)

  Sets the array of bytes to use as a buffer to read from.

  Parameters:
    `byteBuffer` - the array of bytes to use as a buffer

### setPosition

    public void setPosition(int positionToSet)

  Set the current position to write to/ read from

  Parameters:
    `position` - the position (0-based index)

### setWasMultiPacket

    public void setWasMultiPacket(boolean flag)

  Sets whether this packet was part of a multipacket

  Parameters:
    `flag` - was this packet part of a multipacket?

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### toSuperString

    public java.lang.String toSuperString()

### wasMultiPacket

    public boolean wasMultiPacket()

  Was this packet part of a multipacket?

  Returns:
    was this packet part of a multipacket?

### writeByte

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

  Throws:
    `java.sql.SQLException`

### writeBytesNoNull

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

  Throws:
    `java.sql.SQLException`

### writeBytesNoNull

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

  Throws:
    `java.sql.SQLException`

### writeDouble

    final void writeDouble(double d)
                    throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### writeFieldLength

    final void writeFieldLength(long length)
                         throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### writeFloat

    final void writeFloat(float f)
                   throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### writeInt

    final void writeInt(int i)
                 throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### writeLenBytes

    final void writeLenBytes(byte[] b)
                      throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### writeLenString

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

  Throws:
    `java.io.UnsupportedEncodingException`
    `java.sql.SQLException`

### writeLong

    final void writeLong(long i)
                  throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### writeLongInt

    final void writeLongInt(int i)
                     throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### writeLongLong

    final void writeLongLong(long i)
                      throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### writeString

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

  Throws:
    `java.sql.SQLException`

### writeString

    final void writeString(java.lang.String s,
                           java.lang.String encoding,
                           MySQLConnection conn)
                    throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### writeStringNoNull

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

  Throws:
    `java.sql.SQLException`

### writeStringNoNull

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

  Throws:
    `java.io.UnsupportedEncodingException`
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD