com.javanut.pronghorn.util.primitive.ByteArrayQueue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pronghorn-pipes Show documentation
Show all versions of pronghorn-pipes Show documentation
Ring buffer based queuing utility for applications that require high performance and/or a small
footprint. Well suited for embedded and stream based processing.
package com.javanut.pronghorn.util.primitive;
import java.util.concurrent.atomic.AtomicInteger;
import com.javanut.pronghorn.pipe.DataInputBlobReader;
import com.javanut.pronghorn.pipe.DataOutputBlobWriter;
import com.javanut.pronghorn.pipe.Pipe;
public class ByteArrayQueue {
private final int size;
private final int dataMask;
private final byte[] data;
private AtomicInteger head;
private AtomicInteger tail;
private final int[] temp = new int[1];
private byte[] lastInputValue = new byte[256];
private int lastInputLength = 0;
private byte[] lastOutputValue = new byte[256];
private int lastOutputLength = 0;
private final int maxLength;
public ByteArrayQueue(int bits, int maxLength) {
this.size = 1<h) {
room = t-h;
} else {
room = (size-h)+t;
}
if (roomh) {
room = t-h;
} else {
room = (size-h)+t;
}
if (room
© 2015 - 2025 Weber Informatics LLC | Privacy Policy