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


Java PipeWriter.outputStream方法代码示例

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


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

示例1: publishOnPrivateTopic

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的package包/类
private boolean publishOnPrivateTopic(int token, Writable writable) {
	//this is a private topic            
	Pipe<MessagePrivate> output = publishPrivateTopics.getPipe(token);
	if (PipeWriter.tryWriteFragment(output, MessagePrivate.MSG_PUBLISH_1)) {
				
		DataOutputBlobWriter<MessagePrivate> writer = PipeWriter.outputStream(output);
		DataOutputBlobWriter.openField(writer);
		writable.write(writer);
		DataOutputBlobWriter.closeHighLevelField(writer, MessagePrivate.MSG_PUBLISH_1_FIELD_PAYLOAD_3);
		
		PipeWriter.publishWrites(output);

		return true;
	} else {
		return false;
	}
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:18,代码来源:MsgCommandChannel.java

示例2: publishConnect

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的package包/类
private void publishConnect(Pipe<MQTTClientRequestSchema> output) {

		PipeWriter.presumeWriteFragment(output, MQTTClientRequestSchema.MSG_CONNECT_1);
			
	    PipeWriter.writeInt(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_KEEPALIVESEC_28, keepAliveSeconds);
	    PipeWriter.writeInt(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_FLAGS_29, flags);
	    PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_CLIENTID_30, (CharSequence) clientId);
	    PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_WILLTOPIC_31, (CharSequence) lastWillTopic);
	    
	    DataOutputBlobWriter<MQTTClientRequestSchema> writer = PipeWriter.outputStream(output);
	    DataOutputBlobWriter.openField(writer);	
	    if(null!= lastWillPayload) {
	    	lastWillPayload.write((MQTTWriter)writer);
	    }
	    DataOutputBlobWriter.closeHighLevelField(writer, MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_WILLPAYLOAD_32);
	    
	    PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_USER_33, (CharSequence) user);
	    PipeWriter.writeUTF8(output,MQTTClientRequestSchema.MSG_CONNECT_1_FIELD_PASS_34, (CharSequence) pass);
	    PipeWriter.publishWrites(output);
	}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:21,代码来源:MQTTConfigImpl.java

示例3: streamingRequest

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的package包/类
private void streamingRequest(Pipe<ClientHTTPRequestSchema> pipe, int httpRequestResponseId) {
		
	PipeWriter.presumeWriteFragment(pipe, ClientHTTPRequestSchema.MSG_HTTPGET_100);
	assert(httpRequestResponseId>=0);
	PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_HTTPGET_100_FIELD_DESTINATION_11, httpRequestResponseId);
	PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_HTTPGET_100_FIELD_SESSION_10, httpRequestResponseId);
	PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_HTTPGET_100_FIELD_PORT_1, port);
	PipeWriter.writeUTF8(pipe, ClientHTTPRequestSchema.MSG_HTTPGET_100_FIELD_HOST_2, host);
	PipeWriter.writeUTF8(pipe, ClientHTTPRequestSchema.MSG_HTTPGET_100_FIELD_PATH_3, path);
			
	DataOutputBlobWriter<ClientHTTPRequestSchema> stream = PipeWriter.outputStream(pipe);
	DataOutputBlobWriter.openField(stream);
	myAuth.addHeaders(stream, "GET").append("\r\n");
	
	//myAuth.addHeaders(System.out, "GET");
	
	DataOutputBlobWriter.closeHighLevelField(stream, ClientHTTPRequestSchema.MSG_HTTPGET_100_FIELD_HEADERS_7);

	PipeWriter.publishWrites(pipe);
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:21,代码来源:RequestTwitterUserStreamStage.java

示例4: run

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的package包/类
@Override
public void run() {
	
	while ((activeChannelId != -1) && (null!=activeOutput) && PipeWriter.hasRoomForWrite(activeOutput)   ) {
		
		PipeWriter.presumeWriteFragment(activeOutput, ServerResponseSchema.MSG_TOCHANNEL_100);
	    PipeWriter.writeLong(activeOutput,ServerResponseSchema.MSG_TOCHANNEL_100_FIELD_CHANNELID_21, activeChannelId);
	    PipeWriter.writeInt(activeOutput,ServerResponseSchema.MSG_TOCHANNEL_100_FIELD_SEQUENCENO_23, activeSequenceNo);
	    				    
	    DataOutputBlobWriter<ServerResponseSchema> outputStream = PipeWriter.outputStream(activeOutput);
	    DataOutputBlobWriter.openField(outputStream);
	    
	    appendRemainingPayload(activeOutput);
		
	}		
	
	//TODO: we may need multiple pipes?? not sure about blocking..
	
	//only do when previous is complete.
	if (null == activeOutput) {
		int i = this.inputs.length;
		while ((--i >= 0) && (activeChannelId == -1)) {			
			process(inputs[i], outputs[i]);			
		}
	}
	
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:28,代码来源:ByteArrayPayloadResponseStage.java

示例5: stringAccumulator

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的package包/类
@Override
public ByteConsumer stringAccumulator() { 

	if (activeFieldLoc>0) {
		
		return PipeWriter.outputStream(pipe);
	} else {
		return nullByteConsumer;
	}
}
 
开发者ID:oci-pronghorn,项目名称:PronghornPipes,代码行数:11,代码来源:JSONStreamVisitorToPipe.java

示例6: publishGet

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的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: bearerRequest

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的package包/类
public static void bearerRequest(Pipe<ClientHTTPRequestSchema> pipe, String ck, String cs, String host, int port, int httpRequestResponseId) {
	
	//logger.info("requested new bearer on port {}",port);
	
	PipeWriter.tryWriteFragment(pipe, ClientHTTPRequestSchema.MSG_HTTPPOST_101);
	PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_HTTPPOST_101_FIELD_DESTINATION_11, httpRequestResponseId);
	PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_HTTPPOST_101_FIELD_SESSION_10, 0);
	PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_HTTPPOST_101_FIELD_PORT_1, port);
	PipeWriter.writeUTF8(pipe, ClientHTTPRequestSchema.MSG_HTTPPOST_101_FIELD_HOST_2, host);
	PipeWriter.writeUTF8(pipe, ClientHTTPRequestSchema.MSG_HTTPPOST_101_FIELD_PATH_3, path);
	
	//builder.append("Accept-Encoding: gzip\r\n");//Accept: */*\r\n");	
	//
	//Content-Type: application/x-www-form-urlencoded;charset=UTF-8
	//Authorization: Basic <64 ENCODED bearerTokenCred>
	//Accept-Encoding: gzip
	//User-Agent: My Twitter App v1.0.23
	
	
	DataOutputBlobWriter<ClientHTTPRequestSchema> stream = PipeWriter.outputStream(pipe);
	DataOutputBlobWriter.openField(stream);		
	writeHeaders(ck, cs, stream);
	DataOutputBlobWriter.closeHighLevelField(stream, ClientHTTPRequestSchema.MSG_HTTPPOST_101_FIELD_HEADERS_7);
	
	String payload = "grant_type=client_credentials";
	PipeWriter.writeUTF8(pipe, ClientHTTPRequestSchema.MSG_HTTPPOST_101_FIELD_PAYLOAD_5, payload);		
	PipeWriter.publishWrites(pipe);
	
	

	
	
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:34,代码来源:OAuth2BearerUtil.java

示例8: stringBegin

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的package包/类
@Override
public void stringBegin() {
	
	if (activeFieldLoc>0) {
				
			DataOutputBlobWriter<M> out = PipeWriter.outputStream(pipe);
			DataOutputBlobWriter.openField(out);
	
	}
	
}
 
开发者ID:oci-pronghorn,项目名称:PronghornPipes,代码行数:12,代码来源:JSONStreamVisitorToPipe.java

示例9: stringEnd

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的package包/类
@Override
public void stringEnd() {
	if (activeFieldLoc>0) {
		
		if (!mapper.isNumeric(activeFieldLoc)) {
		
			
			DataOutputBlobWriter<M> out = PipeWriter.outputStream(pipe);

			//this data looks correct.
			//byte[] byteArray = out.toByteArray();
			//System.err.println(activeFieldLoc+" CAPTURED TEXT:"+new String(byteArray));
							
			
			int len = DataOutputBlobWriter.closeHighLevelField(out, activeFieldLoc);
			
			
			
		} else {
			pipe.closeBlobFieldWrite();			
		    				
			//	System.err.println("UNABLE TO PARSE NUMERIC:"+new String(out.toByteArray()));
			
		}
		
		activeFieldLoc = 0;
	}
}
 
开发者ID:oci-pronghorn,项目名称:PronghornPipes,代码行数:29,代码来源:JSONStreamVisitorToPipe.java

示例10: pipeDataTest2

import com.ociweb.pronghorn.pipe.PipeWriter; //导入方法依赖的package包/类
@Test
public void pipeDataTest2() {
	
	
	Pipe pipe = TwitterEventSchema.instance.newPipe(10, 1000);
	pipe.initBuffers();
	DataOutputBlobWriter writer = PipeWriter.outputStream(pipe);

	PipeWriter.blockWriteFragment(pipe, TwitterEventSchema.MSG_USERPOST_101);
	//PipeWriter.tryWriteFragment(pipe, TwitterEventSchema.MSG_USERPOST_101);
	
	DataOutputBlobWriter.openField(writer);
	writer.writeUTF8Text("this is todays date");
	DataOutputBlobWriter.closeHighLevelField(writer, TwitterEventSchema.MSG_USERPOST_101_FIELD_CREATEDAT_57);
			
	DataOutputBlobWriter.openField(writer);
	writer.writeUTF8Text("en");
	DataOutputBlobWriter.closeHighLevelField(writer, TwitterEventSchema.MSG_USERPOST_101_FIELD_LANGUAGE_60);
	
	DataOutputBlobWriter.openField(writer);
	writer.writeUTF8Text("name");
	DataOutputBlobWriter.closeHighLevelField(writer, TwitterEventSchema.MSG_USERPOST_101_FIELD_NAME_52);
	
	PipeWriter.publishWrites(pipe);

	PipeWriter.tryWriteFragment(pipe, TwitterEventSchema.MSG_USERPOST_101);
	
	DataOutputBlobWriter.openField(writer);
	writer.writeUTF8Text("2 this is todays date");
	DataOutputBlobWriter.closeHighLevelField(writer, TwitterEventSchema.MSG_USERPOST_101_FIELD_CREATEDAT_57);
			
	DataOutputBlobWriter.openField(writer);
	writer.writeUTF8Text("2 en");
	DataOutputBlobWriter.closeHighLevelField(writer, TwitterEventSchema.MSG_USERPOST_101_FIELD_LANGUAGE_60);
	
	DataOutputBlobWriter.openField(writer);
	writer.writeUTF8Text("2 name");
	DataOutputBlobWriter.closeHighLevelField(writer, TwitterEventSchema.MSG_USERPOST_101_FIELD_NAME_52);
	
	PipeWriter.publishWrites(pipe);
	
			
	assertTrue(PipeReader.tryReadFragment(pipe));
	
	assertEquals("name",PipeReader.readUTF8(pipe, TwitterEventSchema.MSG_USERPOST_101_FIELD_NAME_52, new StringBuilder()).toString());
	assertEquals("en",PipeReader.readUTF8(pipe, TwitterEventSchema.MSG_USERPOST_101_FIELD_LANGUAGE_60, new StringBuilder()).toString());
	assertEquals("this is todays date",PipeReader.readUTF8(pipe, TwitterEventSchema.MSG_USERPOST_101_FIELD_CREATEDAT_57, new StringBuilder()).toString());
	
	PipeReader.releaseReadLock(pipe);
	
	assertTrue(PipeReader.tryReadFragment(pipe));
	
	assertEquals("2 name",PipeReader.readUTF8(pipe, TwitterEventSchema.MSG_USERPOST_101_FIELD_NAME_52, new StringBuilder()).toString());
	assertEquals("2 en",PipeReader.readUTF8(pipe, TwitterEventSchema.MSG_USERPOST_101_FIELD_LANGUAGE_60, new StringBuilder()).toString());
	assertEquals("2 this is todays date",PipeReader.readUTF8(pipe, TwitterEventSchema.MSG_USERPOST_101_FIELD_CREATEDAT_57, new StringBuilder()).toString());
	
	PipeReader.releaseReadLock(pipe);
	
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:60,代码来源:OutOfOrderPipeTest.java


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