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

com.javanut.pronghorn.pipe.FragmentReader 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 FragmentReader {

	
    public static > int readI(Pipe pipe) {

    	int msgIdx = Pipe.takeMsgIdx(pipe);
    	assert(3==Pipe.from(pipe).fragDataSize[msgIdx]) : "This constant does not this fragment size";
    	int value = Pipe.takeInt(pipe);
     	Pipe.confirmLowLevelRead(pipe, 3);
     	Pipe.releaseReadLock(pipe);
    	return value;
    	        
    }
    
    public static > long readL(Pipe pipe) {

    	int msgIdx = Pipe.takeMsgIdx(pipe);
    	assert(3==Pipe.from(pipe).fragDataSize[msgIdx]) : "This constant does not this fragment size";
    	long value = Pipe.takeLong(pipe);
     	Pipe.confirmLowLevelRead(pipe, 3);
     	Pipe.releaseReadLock(pipe);
    	return value;
    	        
    }
	
}