Top Description Fields Constructors Methods
org.apache.commons.compress.archivers.zip

pack-priv final Class CircularBuffer

extends Object
Class Inheritance

Circular byte buffer.
Since
1.7

Field Summary

Modifier and TypeField and Description
private final byte[]
buffer

The buffer

private int
readIndex

Index of the next data to be read from the buffer

private final int
size

Size of the buffer

private int
writeIndex

Index of the next data written in the buffer

Constructor Summary

AccessConstructor and Description
pack-priv
CircularBuffer(final int size)

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

Whether a new byte can be read from the buffer.
available
()

Tests whether a new byte can be read from the buffer.

public void
copy(final int
the distance from the current write position
distance
,
final int
the number of bytes to copy
length
)

Copies a previous interval in the buffer to the current position.

public int

Returns:

a byte from the buffer.
get
()

Reads a byte from the buffer.

public void
put(final int
the value to put.
value
)

Puts a byte to the buffer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final byte[] buffer

The buffer

readIndexback to summary
private int readIndex

Index of the next data to be read from the buffer

sizeback to summary
private final int size

Size of the buffer

writeIndexback to summary
private int writeIndex

Index of the next data written in the buffer

Constructor Detail

CircularBufferback to summary
pack-priv CircularBuffer(final int size)

Method Detail

availableback to summary
public boolean available()

Tests whether a new byte can be read from the buffer.

Returns:boolean

Whether a new byte can be read from the buffer.

copyback to summary
public void copy(final int distance, final int length)

Copies a previous interval in the buffer to the current position.

Parameters
distance:int

the distance from the current write position

length:int

the number of bytes to copy

getback to summary
public int get()

Reads a byte from the buffer.

Returns:int

a byte from the buffer.

putback to summary
public void put(final int value)

Puts a byte to the buffer.

Parameters
value:int

the value to put.