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

com.javanut.pronghorn.pipe.RawDataSchemaUtil 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.pipe;

public class RawDataSchemaUtil {

	public static boolean accumulateInputStream(Pipe pipe) {
		int msgIdx = Pipe.takeMsgIdx(pipe);
		boolean isEnd;
		if (RawDataSchema.MSG_CHUNKEDSTREAM_1 == msgIdx) {
			isEnd = DataInputBlobReader.accumLowLevelAPIField(Pipe.inputStream(pipe))<=0;
			Pipe.confirmLowLevelRead(pipe, Pipe.sizeOf(pipe, RawDataSchema.MSG_CHUNKEDSTREAM_1));
		} else {
			//eof
			isEnd = true;
			Pipe.confirmLowLevelRead(pipe, Pipe.EOF_SIZE);
		}
		Pipe.readNextWithoutReleasingReadLock(pipe);
		return isEnd;
	}

	public static void releaseConsumed(Pipe pipe, ChannelReader reader, int startingAvail) {
		//release the number of bytes we consumed
		Pipe.releasePendingAsReadLock(pipe, startingAvail-reader.available());
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy