Class FrameWriterBuffer
java.lang.Object
org.apache.qpid.proton.engine.impl.FrameWriterBuffer
- All Implemented Interfaces:
WritableBuffer
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.qpid.proton.codec.WritableBuffer
WritableBuffer.ByteBufferWrapper -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new WritableBuffer with default capacity.FrameWriterBuffer(int capacity) Create a new WritableBuffer with the given capacity. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]array()intvoidensureRemaining(int requiredRemaining) Ensures the the buffer has at least the requiredRemaining space specified.booleanintlimit()intposition()voidposition(int position) voidput(byte b) voidput(byte[] src, int offset, int length) voidput(ByteBuffer payload) voidput(ReadableBuffer payload) voidputDouble(double value) voidputFloat(float value) voidputInt(int value) voidputLong(long value) voidputShort(short value) intinttransferTo(ByteBuffer target) Copy bytes from this buffer into the target buffer and compacts this buffer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.qpid.proton.codec.WritableBuffer
put
-
Field Details
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITY- See Also:
-
-
Constructor Details
-
FrameWriterBuffer
public FrameWriterBuffer()Creates a new WritableBuffer with default capacity. -
FrameWriterBuffer
public FrameWriterBuffer(int capacity) Create a new WritableBuffer with the given capacity.- Parameters:
capacity- the inital capacity to allocate for this buffer.
-
-
Method Details
-
array
public byte[] array() -
arrayOffset
public int arrayOffset() -
put
public void put(byte b) - Specified by:
putin interfaceWritableBuffer
-
putShort
public void putShort(short value) - Specified by:
putShortin interfaceWritableBuffer
-
putInt
public void putInt(int value) - Specified by:
putIntin interfaceWritableBuffer
-
putLong
public void putLong(long value) - Specified by:
putLongin interfaceWritableBuffer
-
putFloat
public void putFloat(float value) - Specified by:
putFloatin interfaceWritableBuffer
-
putDouble
public void putDouble(double value) - Specified by:
putDoublein interfaceWritableBuffer
-
put
public void put(byte[] src, int offset, int length) - Specified by:
putin interfaceWritableBuffer
-
put
- Specified by:
putin interfaceWritableBuffer
-
put
- Specified by:
putin interfaceWritableBuffer
-
hasRemaining
public boolean hasRemaining()- Specified by:
hasRemainingin interfaceWritableBuffer
-
remaining
public int remaining()- Specified by:
remainingin interfaceWritableBuffer
-
ensureRemaining
public void ensureRemaining(int requiredRemaining) Ensures the the buffer has at least the requiredRemaining space specified.The internal buffer will be doubled if the requested capacity is less than that amount or the buffer will be expanded to the full new requiredRemaining value.
- Specified by:
ensureRemainingin interfaceWritableBuffer- Parameters:
requiredRemaining- the minimum remaining bytes needed to meet the next write operation.
-
position
public int position()- Specified by:
positionin interfaceWritableBuffer
-
position
public void position(int position) - Specified by:
positionin interfaceWritableBuffer
-
limit
public int limit()- Specified by:
limitin interfaceWritableBuffer
-
transferTo
Copy bytes from this buffer into the target buffer and compacts this buffer.Copy either all bytes written into this buffer (start to current position) or as many as will fit if the target capacity is less that the bytes written. Bytes not read from this buffer are moved to the front of the buffer and the position is reset to the end of the copied region.
- Parameters:
target- The array to move bytes to from those written into this buffer.- Returns:
- the number of bytes transfered to the target buffer.
-