Package org.aksw.commons.io.buffer.ring
Class RingBufferForBytes
java.lang.Object
org.aksw.commons.io.buffer.ring.RingBufferBase<byte[]>
org.aksw.commons.io.buffer.ring.RingBufferForBytes
- All Implemented Interfaces:
HasArrayOps<byte[]>,ReadableSource<byte[]>
Adapter of
RingBufferBase for bytes.-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRingBufferForBytes(byte[] data, int start, int end, boolean isEmpty) RingBufferForBytes(int size) -
Method Summary
Modifier and TypeMethodDescriptionintappend(int maxRemaining, ToIntFunction<ByteBuffer> callback) Provide a byte buffer view over the ring buffer to directly write bytes into a backing array of this buffer.byteget(int offset) ArrayOps<byte[]>Append data from the byte buffer.intread(ByteBuffer out) Returns a new instance with the same data but a copy of the start and end pointers.shallowClone(int customStart, int length) skip(int length) Increment the start pointer by the given amount.toString()Methods inherited from class org.aksw.commons.io.buffer.ring.RingBufferBase
appendCapacity, available, capacity, fill, fill, getEnd, getStart, incEnd, incStart, isEmpty, length, preRead, read, resizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.aksw.commons.io.input.ReadableSource
readRaw
-
Constructor Details
-
RingBufferForBytes
public RingBufferForBytes(int size) -
RingBufferForBytes
protected RingBufferForBytes(byte[] data, int start, int end, boolean isEmpty)
-
-
Method Details
-
get
public byte get(int offset) -
read
-
skip
Description copied from class:RingBufferBaseIncrement the start pointer by the given amount. Raises an invalid argument exception if the length is greater thanRingBufferBase.available().- Overrides:
skipin classRingBufferBase<byte[]>
-
append
Provide a byte buffer view over the ring buffer to directly write bytes into a backing array of this buffer. The buffer provides place for at most capacity() bytes. -
getArrayOps
Append data from the byte buffer. -
shallowClone
Returns a new instance with the same data but a copy of the start and end pointers. The purpose is to support reading data from the buffer and eventually reset the state. -
shallowClone
-
toString
-
toString
-