- java.lang.Object
-
- kala.compress.archivers.zip.CircularBuffer
-
final class CircularBuffer extends java.lang.ObjectCircular byte buffer.- Since:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]bufferThe bufferprivate intreadIndexIndex of the next data to be read from the bufferprivate intsizeSize of the bufferprivate intwriteIndexIndex of the next data written in the buffer
-
Constructor Summary
Constructors Constructor Description CircularBuffer(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanavailable()Tests whether a new byte can be read from the buffer.voidcopy(int distance, int length)Copies a previous interval in the buffer to the current position.intget()Reads a byte from the buffer.voidput(int value)Puts a byte to the buffer.
-
-
-
Method Detail
-
available
public boolean available()
Tests whether a new byte can be read from the buffer.- Returns:
- Whether a new byte can be read from the buffer.
-
copy
public void copy(int distance, int length)Copies a previous interval in the buffer to the current position.- Parameters:
distance- the distance from the current write positionlength- the number of bytes to copy
-
get
public int get()
Reads a byte from the buffer.- Returns:
- a byte from the buffer.
-
put
public void put(int value)
Puts a byte to the buffer.- Parameters:
value- the value to put.
-
-