All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.javanut.pronghorn.util.primitive.ByteArrayQueue Maven / Gradle / Ivy

Go to download

Ring buffer based queuing utility for applications that require high performance and/or a small footprint. Well suited for embedded and stream based processing.

There is a newer version: 1.1.27
Show newest version
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