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


Java PipeReader.readBytes方法代码示例

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


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

示例1: consumeConnect

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumeConnect(Pipe<MQTTClientRequestSchema> input) {
    int fieldKeepAliveSec = PipeReader.readInt(input,MSG_CONNECT_1_FIELD_KEEPALIVESEC_28);
    int fieldFlags = PipeReader.readInt(input,MSG_CONNECT_1_FIELD_FLAGS_29);
    StringBuilder fieldClientId = PipeReader.readUTF8(input,MSG_CONNECT_1_FIELD_CLIENTID_30,new StringBuilder(PipeReader.readBytesLength(input,MSG_CONNECT_1_FIELD_CLIENTID_30)));
    StringBuilder fieldWillTopic = PipeReader.readUTF8(input,MSG_CONNECT_1_FIELD_WILLTOPIC_31,new StringBuilder(PipeReader.readBytesLength(input,MSG_CONNECT_1_FIELD_WILLTOPIC_31)));
    ByteBuffer fieldWillPayload = PipeReader.readBytes(input,MSG_CONNECT_1_FIELD_WILLPAYLOAD_32,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_CONNECT_1_FIELD_WILLPAYLOAD_32)));
    StringBuilder fieldUser = PipeReader.readUTF8(input,MSG_CONNECT_1_FIELD_USER_33,new StringBuilder(PipeReader.readBytesLength(input,MSG_CONNECT_1_FIELD_USER_33)));
    StringBuilder fieldPass = PipeReader.readUTF8(input,MSG_CONNECT_1_FIELD_PASS_34,new StringBuilder(PipeReader.readBytesLength(input,MSG_CONNECT_1_FIELD_PASS_34)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:10,代码来源:MQTTClientRequestSchema.java

示例2: consumePublish

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
private void consumePublish(Pipe<MQTTServerToClientSchema> input) {
	long fieldTime = PipeReader.readLong(input,MQTTServerToClientSchema.MSG_PUBLISH_3_FIELD_TIME_37);
	int fieldPacketId = PipeReader.readInt(input,MQTTServerToClientSchema.MSG_PUBLISH_3_FIELD_PACKETID_20);
	int fieldQOS = PipeReader.readInt(input,MQTTServerToClientSchema.MSG_PUBLISH_3_FIELD_QOS_21);
	int fieldRetain = PipeReader.readInt(input,MQTTServerToClientSchema.MSG_PUBLISH_3_FIELD_RETAIN_22);
	int fieldDup = PipeReader.readInt(input,MQTTServerToClientSchema.MSG_PUBLISH_3_FIELD_DUP_36);
	StringBuilder fieldTopic = PipeReader.readUTF8(input,MQTTServerToClientSchema.MSG_PUBLISH_3_FIELD_TOPIC_23,new StringBuilder(PipeReader.readBytesLength(input,MQTTServerToClientSchema.MSG_PUBLISH_3_FIELD_TOPIC_23)));
	ByteBuffer fieldPayload = PipeReader.readBytes(input,MQTTServerToClientSchema.MSG_PUBLISH_3_FIELD_PAYLOAD_25,ByteBuffer.allocate(PipeReader.readBytesLength(input,MQTTServerToClientSchema.MSG_PUBLISH_3_FIELD_PAYLOAD_25)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:10,代码来源:MQTTServerToClientEncodeStage.java

示例3: simpleBytesWriteRead

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
@Test
  public void simpleBytesWriteRead() {
  
  	byte primaryRingSizeInBits = 7; //this ring is 2^7 eg 128
  	byte byteRingSizeInBits = 16;
  	
Pipe ring = new Pipe(new PipeConfig(RawDataSchema.instance, 1<<primaryRingSizeInBits, 1<<byteRingSizeInBits));
  	ring.initBuffers();
  	
      int messageSize = FROM.fragDataSize[FRAG_LOC];
      
      int varDataMax = (ring.blobMask/(ring.slabMask>>1))/messageSize;        
      int testSize = (1<<primaryRingSizeInBits)/messageSize;

      populateRingBufferWithBytes(ring, varDataMax, testSize);
      
      //now read the data back        
      int BYTE_LOC = FieldReferenceOffsetManager.lookupFieldLocator("ByteArray", FRAG_LOC, FROM);
      
      byte[] target = new byte[varDataMax];
      int k = testSize;
      while (PipeReader.tryReadFragment(ring)) {
      	if (PipeReader.isNewMessage(ring)) {
      		assertEquals(0, PipeReader.getMsgIdx(ring));
      		
       	int expectedLength = (varDataMax*(--k))/testSize;	
       	int actualLength = PipeReader.readBytes(ring, BYTE_LOC, target, 0); //read bytes as normal code would do
       	assertEquals(expectedLength,actualLength);
      		        		
      	}
      }    
  }
 
开发者ID:oci-pronghorn,项目名称:PronghornPipes,代码行数:33,代码来源:PipeSingleTemplateTest.java

示例4: consumePublish

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumePublish(Pipe<IngressMessages> input) {
    StringBuilder fieldTopic = PipeReader.readUTF8(input,MSG_PUBLISH_103_FIELD_TOPIC_1,new StringBuilder(PipeReader.readBytesLength(input,MSG_PUBLISH_103_FIELD_TOPIC_1)));
    ByteBuffer fieldPayload = PipeReader.readBytes(input,MSG_PUBLISH_103_FIELD_PAYLOAD_3,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_PUBLISH_103_FIELD_PAYLOAD_3)));
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:5,代码来源:IngressMessages.java

示例5: consumePublish

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumePublish(Pipe<MessageSubscription> input) {
    StringBuilder fieldTopic = PipeReader.readUTF8(input,MSG_PUBLISH_103_FIELD_TOPIC_1,new StringBuilder(PipeReader.readBytesLength(input,MSG_PUBLISH_103_FIELD_TOPIC_1)));
    ByteBuffer fieldPayload = PipeReader.readBytes(input,MSG_PUBLISH_103_FIELD_PAYLOAD_3,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_PUBLISH_103_FIELD_PAYLOAD_3)));
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:5,代码来源:MessageSubscription.java

示例6: 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

示例7: consumePublish

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumePublish(Pipe<MQTTClientRequestSchema> input) {
    int fieldQOS = PipeReader.readInt(input,MSG_PUBLISH_3_FIELD_QOS_21);
    int fieldRetain = PipeReader.readInt(input,MSG_PUBLISH_3_FIELD_RETAIN_22);
    StringBuilder fieldTopic = PipeReader.readUTF8(input,MSG_PUBLISH_3_FIELD_TOPIC_23,new StringBuilder(PipeReader.readBytesLength(input,MSG_PUBLISH_3_FIELD_TOPIC_23)));
    ByteBuffer fieldPayload = PipeReader.readBytes(input,MSG_PUBLISH_3_FIELD_PAYLOAD_25,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_PUBLISH_3_FIELD_PAYLOAD_25)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:7,代码来源:MQTTClientRequestSchema.java

示例8: consumeSubRelease

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumeSubRelease(Pipe<BlockManagerRequestSchema> input) {
    long fieldId = PipeReader.readLong(input,MSG_SUBRELEASE_2_FIELD_ID_11);
    ByteBuffer fieldRoute = PipeReader.readBytes(input,MSG_SUBRELEASE_2_FIELD_ROUTE_14,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_SUBRELEASE_2_FIELD_ROUTE_14)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:5,代码来源:BlockManagerRequestSchema.java

示例9: consumeSubWrite

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumeSubWrite(Pipe<BlockManagerRequestSchema> input) {
    long fieldId = PipeReader.readLong(input,MSG_SUBWRITE_3_FIELD_ID_11);
    ByteBuffer fieldPayload = PipeReader.readBytes(input,MSG_SUBWRITE_3_FIELD_PAYLOAD_12,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_SUBWRITE_3_FIELD_PAYLOAD_12)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:5,代码来源:BlockManagerRequestSchema.java

示例10: consumeBlockMount

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumeBlockMount(Pipe<BlockManagerRequestSchema> input) {
    ByteBuffer fieldRoute = PipeReader.readBytes(input,MSG_BLOCKMOUNT_5_FIELD_ROUTE_14,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_BLOCKMOUNT_5_FIELD_ROUTE_14)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:4,代码来源:BlockManagerRequestSchema.java

示例11: consumeBlockRelease

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumeBlockRelease(Pipe<BlockManagerRequestSchema> input) {
    ByteBuffer fieldRoute = PipeReader.readBytes(input,MSG_BLOCKRELEASE_7_FIELD_ROUTE_14,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_BLOCKRELEASE_7_FIELD_ROUTE_14)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:4,代码来源:BlockManagerRequestSchema.java

示例12: consumeSubAllocated

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumeSubAllocated(Pipe<BlockManagerResponseSchema> input) {
    long fieldId = PipeReader.readLong(input,MSG_SUBALLOCATED_1_FIELD_ID_11);
    ByteBuffer fieldRoute = PipeReader.readBytes(input,MSG_SUBALLOCATED_1_FIELD_ROUTE_14,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_SUBALLOCATED_1_FIELD_ROUTE_14)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:5,代码来源:BlockManagerResponseSchema.java

示例13: consumeSubRead

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumeSubRead(Pipe<BlockManagerResponseSchema> input) {
    ByteBuffer fieldPayload = PipeReader.readBytes(input,MSG_SUBREAD_4_FIELD_PAYLOAD_13,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_SUBREAD_4_FIELD_PAYLOAD_13)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:4,代码来源:BlockManagerResponseSchema.java

示例14: consumeReadHeader

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumeReadHeader(Pipe<BlockManagerResponseSchema> input) {
    long fieldId = PipeReader.readLong(input,MSG_READHEADER_8_FIELD_ID_11);
    ByteBuffer fieldPayload = PipeReader.readBytes(input,MSG_READHEADER_8_FIELD_PAYLOAD_13,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_READHEADER_8_FIELD_PAYLOAD_13)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:5,代码来源:BlockManagerResponseSchema.java

示例15: consumeBlockAllocated

import com.ociweb.pronghorn.pipe.PipeReader; //导入方法依赖的package包/类
public static void consumeBlockAllocated(Pipe<BlockManagerResponseSchema> input) {
    ByteBuffer fieldRoute = PipeReader.readBytes(input,MSG_BLOCKALLOCATED_6_FIELD_ROUTE_14,ByteBuffer.allocate(PipeReader.readBytesLength(input,MSG_BLOCKALLOCATED_6_FIELD_ROUTE_14)));
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:4,代码来源:BlockManagerResponseSchema.java


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