当前位置: 首页>>代码示例>>Java>>正文


Java PipeReader.readBytesBackingArray方法代码示例

本文整理汇总了Java中com.ociweb.pronghorn.pipe.PipeReader.readBytesBackingArray方法的典型用法代码示例。如果您正苦于以下问题:Java PipeReader.readBytesBackingArray方法的具体用法?Java PipeReader.readBytesBackingArray怎么用?Java PipeReader.readBytesBackingArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.ociweb.pronghorn.pipe.PipeReader的用法示例。


在下文中一共展示了PipeReader.readBytesBackingArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
@Override
public void run() {
    
    if (moveInProgress) {
        if (!PipeReader.tryMoveSingleMessage(input, output)) {
            return;
        } else {
            moveInProgress = false;
            PipeReader.releaseReadLock(input);
        }
    }
    
    
    boolean updateFile = false;
    
    while (PipeWriter.hasRoomForWrite(output) && PipeReader.tryReadFragment(input)) {
        updateFile = true;
        byte[] backing = PipeReader.readBytesBackingArray(input, varFieldLoc);
        int pos = PipeReader.readBytesPosition(input, varFieldLoc);
        int len = PipeReader.readBytesLength(input, varFieldLoc);
        int mask = PipeReader.readBytesMask(input, varFieldLoc);
                    
        if (!filter.mayContain(backing,pos,len,mask)) {
            filter.addValue(backing,pos,len,mask);                

            if (! PipeReader.tryMoveSingleMessage(input, output)) {
                moveInProgress = true;
                return;
            }
            
        }
        
        PipeReader.releaseReadLock(input);
    }
    if (updateFile) {
        saveFilter();
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:39,代码来源:PassUniquesFilterStage.java

示例2: run

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
@Override
public void run() {
    if (moveInProgress) {
        if (!PipeReader.tryMoveSingleMessage(input, output)) {
            return;
        } else {
            moveInProgress = false;
            PipeReader.releaseReadLock(input);
        }
    }
    
    boolean updateFile = false;
    while (PipeWriter.hasRoomForWrite(output) && PipeReader.tryReadFragment(input)) {
        updateFile = true;            
        byte[] backing = PipeReader.readBytesBackingArray(input, varFieldLoc);
        int pos = PipeReader.readBytesPosition(input, varFieldLoc);
        int len = PipeReader.readBytesLength(input, varFieldLoc);
        int mask = PipeReader.readBytesMask(input, varFieldLoc);
        
        int i = instances;
        while (--i>=0 && filters[i].mayContain(backing,pos,len,mask)) {
        }
        
        if (i<0) {
            if (!PipeReader.tryMoveSingleMessage(input, output)) {
                 moveInProgress = true;
                return;
            }
        } else {
            //this one did not contain it so add it.
            filters[i].addValue(backing,pos,len,mask);
        }
        
        PipeReader.releaseReadLock(input);
    }
    if (updateFile) {
        saveFilter();
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:40,代码来源:PassRepeatsFilterStage.java

示例3: processI2CMessage

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
protected void processI2CMessage(Object listener, Pipe<I2CResponseSchema> p) {

			int addr = PipeReader.readInt(p, I2CResponseSchema.MSG_RESPONSE_10_FIELD_ADDRESS_11);
			long time = PipeReader.readLong(p, I2CResponseSchema.MSG_RESPONSE_10_FIELD_TIME_13);
			int register = PipeReader.readInt(p, I2CResponseSchema.MSG_RESPONSE_10_FIELD_REGISTER_14);

			byte[] backing = PipeReader.readBytesBackingArray(p, I2CResponseSchema.MSG_RESPONSE_10_FIELD_BYTEARRAY_12);
			int position = PipeReader.readBytesPosition(p, I2CResponseSchema.MSG_RESPONSE_10_FIELD_BYTEARRAY_12);
			int length = PipeReader.readBytesLength(p, I2CResponseSchema.MSG_RESPONSE_10_FIELD_BYTEARRAY_12);
			int mask = PipeReader.readBytesMask(p, I2CResponseSchema.MSG_RESPONSE_10_FIELD_BYTEARRAY_12);
		    
		    commonI2CEventProcessing((I2CListenerBase) listener, addr, register, time, backing, position, length, mask);

	}
 
开发者ID:oci-pronghorn,项目名称:FogLight,代码行数:15,代码来源:ReactiveIoTListenerStage.java

示例4: publishGet

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
private void publishGet(Pipe<ClientHTTPRequestSchema> requestPipe, final byte[] hostBack, final int hostPos,
		final int hostLen, long connectionId, ClientConnection clientConnection, 
		int fieldNamePath,
		int fieldNameHeaders) {
	int outIdx = clientConnection.requestPipeLineIdx();
	
	clientConnection.incRequestsSent();//count of messages can only be done here.
	Pipe<NetPayloadSchema> outputPipe = output[outIdx];
						
	//TODO: this must be converted to the low level API urgent...
	
	PipeWriter.presumeWriteFragment(outputPipe, NetPayloadSchema.MSG_PLAIN_210);
   	
		PipeWriter.writeLong(outputPipe, NetPayloadSchema.MSG_PLAIN_210_FIELD_CONNECTIONID_201, connectionId);
		PipeWriter.writeLong(outputPipe, NetPayloadSchema.MSG_PLAIN_210_FIELD_ARRIVALTIME_210, System.currentTimeMillis());
		PipeWriter.writeLong(outputPipe, NetPayloadSchema.MSG_PLAIN_210_FIELD_POSITION_206, 0);
		
		DataOutputBlobWriter<NetPayloadSchema> activeWriter = PipeWriter.outputStream(outputPipe);
		DataOutputBlobWriter.openField(activeWriter);
		
		DataOutputBlobWriter.write(activeWriter,GET,0,GET.length);
		
		int len = PipeReader.readBytesLength(requestPipe, fieldNamePath);					                	
		int  first = PipeReader.readBytesPosition(requestPipe, fieldNamePath);					                	
		boolean prePendSlash = (0==len) || ('/' != PipeReader.readBytesBackingArray(requestPipe, fieldNamePath)[first&Pipe.blobMask(requestPipe)]);  
		
		if (prePendSlash) { //NOTE: these can be pre-coverted to bytes so we need not convert on each write. may want to improve.
			DataOutputBlobWriter.encodeAsUTF8(activeWriter," /");
		} else {
			DataOutputBlobWriter.encodeAsUTF8(activeWriter," ");
		}
		
		//Reading from UTF8 field and writing to UTF8 encoded field so we are doing a direct copy here.
		PipeReader.readBytes(requestPipe, fieldNamePath, activeWriter);
		
		HeaderUtil.writeHeaderBeginning(hostBack, hostPos, hostLen, Pipe.blobMask(requestPipe), activeWriter);
		
		HeaderUtil.writeHeaderMiddle(activeWriter, implementationVersion);
		
		PipeReader.readBytes(requestPipe, fieldNameHeaders, activeWriter);
		HeaderUtil.writeHeaderEnding(activeWriter, true, (long) 0);
		
		DataOutputBlobWriter.closeHighLevelField(activeWriter, NetPayloadSchema.MSG_PLAIN_210_FIELD_PAYLOAD_204);
						                	
		PipeWriter.publishWrites(outputPipe);

}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:48,代码来源:HTTPClientRequestTrafficStage.java

示例5: setDupBitOn

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
private void setDupBitOn() {
    //set the dup bit in case this gets sent again.
    PipeReader.readBytesBackingArray(apiIn, ConInConst.CON_IN_PUBLISH_FIELD_PACKETDATA)
             [PipeReader.readBytesPosition(apiIn, ConInConst.CON_IN_PUBLISH_FIELD_PACKETDATA) &
              PipeReader.readBytesMask(apiIn, ConInConst.CON_IN_PUBLISH_FIELD_PACKETDATA)] |= DUP_BIT;
}
 
开发者ID:oci-pronghorn,项目名称:PronghornGateway,代码行数:7,代码来源:ConnectionStage.java


注:本文中的com.ociweb.pronghorn.pipe.PipeReader.readBytesBackingArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。