com.hunnysoft.jmime
Class ByteBuffer

java.lang.Object
  extended bycom.hunnysoft.jmime.ByteBuffer

public class ByteBuffer
extends java.lang.Object

Byte buffer structure.

The ByteBuffer class is used as a byte buffer structure for various encoders and decoders.

The following code example shows how you can prepare input and output buffers, where the input data is in the byte array myData:

    ByteBuffer inBuf = new ByteBuffer();
    inBuf.bytes = myData;
    inBuf.pos = 0;
    inBuf.endPos = myData.length;
    outBuf = new ByteBuffer();
    outBuf.bytes = new byte[2048];
    outBuf.pos = 0;
    outBuf.endPos = outBuf.bytes.length;

See Also:
CharBuffer

Field Summary
 byte[] bytes
          Byte array that contains input data or that provides output buffer space.
 int endPos
          Offset of the end of the buffer.
 int pos
          Offset of the beginning of the buffer.
 
Constructor Summary
ByteBuffer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytes

public byte[] bytes
Byte array that contains input data or that provides output buffer space.


pos

public int pos
Offset of the beginning of the buffer.

For an input buffer, this value is the offset of the beginning of the unconsumed data in the byte array. For an output buffer, this value is the offset of the beginning of the unused space in the byte array. Offsets are zero-based.


endPos

public int endPos
Offset of the end of the buffer.

This value should be one larger than the offset of the last valid byte position in bytes. For example, if buf.bytes[last] is the last valid byte in the byte array, then buf.endPos should be set to last+1. Offsets are zero-based.

Constructor Detail

ByteBuffer

public ByteBuffer()