jremote jbase5.2.1

com.jbase.jremote.io
Class PrefixByteBuffer

java.lang.Object
  extended by com.jbase.jremote.io.PrefixByteBuffer

public class PrefixByteBuffer
extends Object


Field Summary
static int CHUNK_SIZE
           
 
Constructor Summary
PrefixByteBuffer()
           
 
Method Summary
 void clear()
          Method: clear() Description: Reset buffer to its empty state.
 void flip()
          Method: flip() Description: Similar the ByteBuffer.flip() but the position must be set back to the start of the prefix.
 byte[] getBackingArray()
          Method: getBackingArray() Description: Returns a pointer to the backing array Note: DANGEROUS.
 byte getByte()
           
 void getBytes(byte[] buf)
           
 void getBytes(ByteBuffer bBuf)
           
 int getInt()
           
 int getStartOffset()
           
 String getUTF8()
           
 int length()
           
 void pushByte(int b)
          Write bytes to start methods
 void pushBytes(byte[] b)
           
 void pushInt(int v)
           
 void putByte(int b)
          Write bytes to end methods
 void putBytes(byte[] b)
           
 void putInt(int v)
           
 void putUTF8(String s)
           
 void readFrom(ByteBuffer buf)
          Method: readFrom() Description: Read a BufferBuffer into self as if it had been received from an InputStream.
 void readFrom(InputStream is, int length)
          Method: readFrom() Description: Reads a given number of bytes from a given input stream.
 void writeTo(ByteBuffer buf)
           
 void writeTo(OutputStream os)
          Method: writeTo() Description: Write data to a given OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHUNK_SIZE

public static final int CHUNK_SIZE
See Also:
Constant Field Values
Constructor Detail

PrefixByteBuffer

public PrefixByteBuffer()
Method Detail

length

public int length()

flip

public void flip()
Method: flip() Description: Similar the ByteBuffer.flip() but the position must be set back to the start of the prefix.


clear

public void clear()
Method: clear() Description: Reset buffer to its empty state. Since we will need it again do not loose the backing array.


writeTo

public void writeTo(OutputStream os)
             throws IOException
Method: writeTo() Description: Write data to a given OutputStream. Must be fast so don't use get().

Throws:
IOException

writeTo

public void writeTo(ByteBuffer buf)

readFrom

public void readFrom(InputStream is,
                     int length)
              throws IOException
Method: readFrom() Description: Reads a given number of bytes from a given input stream.

Throws:
IOException

readFrom

public void readFrom(ByteBuffer buf)
Method: readFrom() Description: Read a BufferBuffer into self as if it had been received from an InputStream. Note: USED ONLY FOR UNIT TESTING.


getBackingArray

public byte[] getBackingArray()
Method: getBackingArray() Description: Returns a pointer to the backing array Note: DANGEROUS. DO NOT MODIFY RETURNED ARRAY.


getStartOffset

public int getStartOffset()

putByte

public void putByte(int b)
Write bytes to end methods


putBytes

public void putBytes(byte[] b)

putUTF8

public void putUTF8(String s)
             throws IOException
Throws:
IOException

putInt

public void putInt(int v)

pushByte

public void pushByte(int b)
              throws BufferOverflowException
Write bytes to start methods

Throws:
BufferOverflowException

pushBytes

public void pushBytes(byte[] b)
               throws BufferOverflowException
Throws:
BufferOverflowException

pushInt

public void pushInt(int v)

getByte

public byte getByte()

getInt

public int getInt()

getBytes

public void getBytes(byte[] buf)

getBytes

public void getBytes(ByteBuffer bBuf)

getUTF8

public String getUTF8()
               throws IOException
Throws:
IOException

jremote jbase5.2.1

Copyright © 2016 TEMENOS. All Rights Reserved.