org.drizzle.jdbc.internal.common.packet.buffer
Class Reader

java.lang.Object
  extended by org.drizzle.jdbc.internal.common.packet.buffer.Reader

public class Reader
extends java.lang.Object

. User: marcuse Date: Jan 16, 2009 Time: 8:27:38 PM


Constructor Summary
Reader(RawPacket rawPacket)
           
 
Method Summary
 void appendPacket(RawPacket rawPacket)
           
 byte getByteAt(int i)
           
 long getLengthEncodedBinary()
           
 byte[] getLengthEncodedBytes()
           
 byte[] getLengthEncodedBytesWithLength(long length)
           
 java.lang.String getLengthEncodedString()
           
 byte getPacketSeq()
           
 int getRemainingSize()
           
 long getSilentLengthEncodedBinary()
           
 int read24bitword()
           
 byte readByte()
          reads a byte from the buffer
 int readInt()
          read a int (4 bytes) from the buffer;
 long readLong()
          read a long (8 bytes) from the buffer;
 byte[] readRawBytes(int numberOfBytes)
           
 short readShort()
          read a short (2 bytes) from the buffer;
 java.lang.String readString(java.lang.String charset)
          Reads a string from the buffer, looks for a 0 to end the string
 void skipByte()
           
 long skipBytes(int bytesToSkip)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reader

public Reader(RawPacket rawPacket)
Method Detail

readString

public java.lang.String readString(java.lang.String charset)
                            throws java.io.IOException
Reads a string from the buffer, looks for a 0 to end the string

Parameters:
charset - the charset to use, for example ASCII
Returns:
the read string
Throws:
java.io.IOException - if it is not possible to create the string from the buffer

readShort

public short readShort()
                throws java.io.IOException
read a short (2 bytes) from the buffer;

Returns:
an short
Throws:
java.io.IOException - if there are not 2 bytes left in the buffer

readInt

public int readInt()
            throws java.io.IOException
read a int (4 bytes) from the buffer;

Returns:
a int
Throws:
java.io.IOException - if there are not 4 bytes left in the buffer

readLong

public long readLong()
              throws java.io.IOException
read a long (8 bytes) from the buffer;

Returns:
a long
Throws:
java.io.IOException - if there are not 8 bytes left in the buffer

readByte

public byte readByte()
              throws java.io.IOException
reads a byte from the buffer

Returns:
the byte
Throws:
java.io.IOException - if bufferPointer exceeds the length of the buffer

readRawBytes

public byte[] readRawBytes(int numberOfBytes)
                    throws java.io.IOException
Throws:
java.io.IOException

skipByte

public void skipByte()
              throws java.io.IOException
Throws:
java.io.IOException

skipBytes

public long skipBytes(int bytesToSkip)
               throws java.io.IOException
Throws:
java.io.IOException

read24bitword

public int read24bitword()
                  throws java.io.IOException
Throws:
java.io.IOException

getLengthEncodedBinary

public long getLengthEncodedBinary()
                            throws java.io.IOException
Throws:
java.io.IOException

getLengthEncodedString

public java.lang.String getLengthEncodedString()
                                        throws java.io.IOException
Throws:
java.io.IOException

getLengthEncodedBytes

public byte[] getLengthEncodedBytes()
                             throws java.io.IOException
Throws:
java.io.IOException

getLengthEncodedBytesWithLength

public byte[] getLengthEncodedBytesWithLength(long length)

getByteAt

public byte getByteAt(int i)
               throws java.io.IOException
Throws:
java.io.IOException

getPacketSeq

public byte getPacketSeq()

getRemainingSize

public int getRemainingSize()

appendPacket

public void appendPacket(RawPacket rawPacket)

getSilentLengthEncodedBinary

public long getSilentLengthEncodedBinary()
                                  throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2012. All Rights Reserved.