• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ChannelReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ChannelReader类属于com.ociweb.pronghorn.pipe包,在下文中一共展示了ChannelReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: visitHeaders

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public void visitHeaders(ChannelReader stream, Appendable target) {
	int id = stream.readShort();
	while (id > 0) {
		try {
			
			target.append(headers[id].writingRoot());
			
			headerConsume(id, stream, target);
			target.append("\n");
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		id = stream.readShort();
	}
	
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:19,代码来源:HTTPSpecification.java


示例2: copyStructuredTopic

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public boolean copyStructuredTopic(CharSequence topic, 
								   ChannelReader inputReader, 
		                           MessageConsumer consumer,
		                           WaitFor ap) {
	DataInputBlobReader<?> reader = (DataInputBlobReader<?>)inputReader;
	
	assert((0 != (initFeatures & DYNAMIC_MESSAGING))) : "CommandChannel must be created with DYNAMIC_MESSAGING flag";
	
	int pos = reader.absolutePosition();    	
	if (consumer.process(reader)) {
		
		if ((null==goPipe || PipeWriter.hasRoomForWrite(goPipe)) 
    	    && PipeWriter.tryWriteFragment(messagePubSub, MessagePubSub.MSG_PUBLISH_103)  ) {

 		PipeWriter.writeInt(messagePubSub, MessagePubSub.MSG_PUBLISH_103_FIELD_QOS_5, ap.policy());
 		
 		PipeWriter.writeUTF8(messagePubSub, MessagePubSub.MSG_PUBLISH_103_FIELD_TOPIC_1, topic);            
     	
         PubSubWriter pw = (PubSubWriter) Pipe.outputStream(messagePubSub);
         DataOutputBlobWriter.openField(pw);
         reader.absolutePosition(pos);//restore position as unread
         //direct copy from one to the next
         reader.readInto(pw, reader.available());
	
         DataOutputBlobWriter.closeHighLevelField(pw, MessagePubSub.MSG_PUBLISH_103_FIELD_PAYLOAD_3);
         PipeWriter.publishWrites(messagePubSub);
	 
        	publishGo(1,builder.pubSubIndex(), this);  		
 		
 		return true;
		} else {
			reader.absolutePosition(pos);//restore position as unread
			return false;//needed to consume but no place to go.
		}
	
	} else {
		return true;
	}
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:40,代码来源:MsgCommandChannel.java


示例3: readReqesterData

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public boolean readReqesterData(ChannelReader reader) {
	
	if (Pipe.hasContentToRead(pipe)) {
		
		if (null==headers) {
			//custom call
			commandChannel.publishHTTPResponse(connectionId, sequenceCode, 
                                                  statusCode, hasContinuation, 
                                                  contentType, writable);
		} else {
			//full headers call
			commandChannel.publishHTTPResponse(connectionId, sequenceCode, 
                       						   hasContinuation, headers, writable);
		}
		connectionId = -1;
		sequenceCode = -1;	
		return true;
	} else {
		if (connectionId>=0 && sequenceCode>=0) {
		    //will not pick up new data, waiting for these to be consumed.
			return false;
		} else {
			//wait for a following call
			
			////example of what the writer does
			//writer.writePackedLong(connectionId);
			//writer.writePackedLong(sequenceCode);
			
			connectionId = reader.readPackedLong();
			sequenceCode = reader.readPackedLong();
			return true;
		}
	}
	
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:36,代码来源:HTTPResponder.java


示例4: read

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
@Override
public void read(HTTPHeader header, ChannelReader reader) {
	
	short type = reader.readShort();
	if ((type<0) || (type>=httpSpec.contentTypes.length)) {
		this.type = HTTPContentTypeDefaults.UNKNOWN;
	} else {
		this.type = (HTTPContentType)httpSpec.contentTypes[type];
	}
	
}
 
开发者ID:oci-pronghorn,项目名称:GreenLightning,代码行数:12,代码来源:HeaderTypeCapture.java


示例5: restRequest

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
@Override
public boolean restRequest(final HTTPRequestReader request) {
	
	final StringBuilder cookieValue = new StringBuilder();
	Headable eat = new Headable() {

		@Override
		public void read(HTTPHeader header, ChannelReader httpPayloadReader) {
			httpPayloadReader.readUTF(cookieValue);
			lastCookie = cookieValue.toString();
		}

	};
	request.openHeaderData(HTTPHeaderDefaults.COOKIE.rootBytes(), eat);
			
	
	Writable consume = new Writable() {

		@Override
		public void write(ChannelWriter writer) {
			template.render(writer, request);
		}
		
	};
	
	return cc.publishHTTPResponse(request.getConnectionId(), request.getSequenceCode(), 200, false, 
			                   HTTPContentTypeDefaults.JSON, consume);		

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


示例6: restRequest

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
@Override
public boolean restRequest(final HTTPRequestReader request) {
	
	final StringBuilder cookieValue = new StringBuilder();
	Headable eat = new Headable() {

		@Override
		public void read(HTTPHeader header, ChannelReader httpPayloadReader) {
			httpPayloadReader.readUTF(cookieValue);
			lastCookie = cookieValue.toString();
		}
		
	};
	request.openHeaderData(HTTPHeaderDefaults.COOKIE.rootBytes(),eat);
			
	Writable render = new Writable() {

		@Override
		public void write(ChannelWriter writer) {
				template.render(writer, request);
		}
		
	};
	return cc.publishHTTPResponse(request.getConnectionId(), request.getSequenceCode(), 200, false,
			                   HTTPContentTypeDefaults.JSON, render );		

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


示例7: message

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
@Override
public boolean message(CharSequence topic, ChannelReader payload) {

	 int value = payload.readInt();
        blinkerChannel.setValueAndBlock(IoTApp.LED_PORT, value==1, PAUSE);               
        return blinkerChannel.publishTopic(TOPIC, w->{
       	 w.writeInt( 1==value ? 0 : 1 );        	 
        });
   }
 
开发者ID:oci-pronghorn,项目名称:FogLight-Examples,代码行数:10,代码来源:BlinkerBehavior.java


示例8: message

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
@Override
public boolean message(CharSequence topic, ChannelReader payload) {
	
	if (topic.equals(topicTank)) { //.toString().equals(topicTank.toString())) {
		
		lastTankTime = payload.readLong();
		lastTankDepth = payload.readInt();
		lastTankFuel = payload.readUTF();

	}

	if (topic.equals(topicPump)) {
		
		lastPumpTime = payload.readLong();
		lastPumpFuel = payload.readUTF();
		lastPumpPrice = payload.readInt();	
		lastPumpUnits = payload.readInt();
	
	}
	
	if (topic.equals(topicTotal)) {
		
		//now that we have the total the previous running values are no longer valid
		lastPumpTime = 0;				
		lastPumpUnits = 0;			
		
		long totalTime = payload.readLong();
		lastTotalName = payload.readUTF();
		int price = payload.readInt();
		lastTotalUnits = payload.readInt();
		
		lastTotalPrice = (price*lastTotalUnits)/100;
					
	}
	
	repaint();
	return true;
}
 
开发者ID:oci-pronghorn,项目名称:FogLight-Examples,代码行数:39,代码来源:DisplayController.java


示例9: message

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
@Override
public boolean message(CharSequence topic, ChannelReader payload) {
        	
    if (requestedPBM>0) {

        if (activeBPM != requestedPBM && ((System.currentTimeMillis()-requestTime) > REQ_UNCHANGED_MS || activeBPM==0) ) {
        	activeBPM = requestedPBM;
            base = System.currentTimeMillis(); 
            beatIdx = 0;
        } 
                                
        long delta = (++beatIdx*60_000)/activeBPM;
        long until = base + delta;
        tickCommandChannel.digitalPulse(IoTApp.BUZZER_PORT,500_000);     
        tickCommandChannel.blockUntil(IoTApp.BUZZER_PORT, until);
        

        if (beatIdx==activeBPM) {
        	beatIdx = 0;
        	base += 60_000; 
        }
        
    }
    tickCommandChannel.publishTopic(topic,w->{});//request next tick
    
    return true;
}
 
开发者ID:oci-pronghorn,项目名称:FogLight-Examples,代码行数:28,代码来源:MetronomeBehavior.java


示例10: writeHeader

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public <A extends Appendable> A writeHeader(A target, H header, ChannelReader data) {
	try {
		target.append(header.writingRoot());
		header.writeValue(target, this, data);
	} catch (Throwable e) {
		logger.error("Bad header unable to parse {} ",header);
		throw new RuntimeException(e);
	}

	return target;
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:12,代码来源:HTTPSpecification.java


示例11: decodeDeltaLong

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static long decodeDeltaLong(long[] longDictionary, ChannelReader reader, long map, int idx, long bitMask, Boolean isOptional) {
    if (isOptional && MOST_FREQUENT_CASE == (map & bitMask)){
        bitMask = bitMask << 1;
        return (MOST_FREQUENT_CASE == (map&bitMask)) ? (longDictionary[idx] += reader.readPackedLong()) : longDictionary[idx];
    } else {
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? (longDictionary[idx] += reader.readPackedLong()) : longDictionary[idx];
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:9,代码来源:PhastDecoder.java


示例12: decodeDefaultInt

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static int decodeDefaultInt(ChannelReader reader, long map, int[] defaultValues, long bitMask, int idx, Boolean isOptional) {
    if (isOptional && MOST_FREQUENT_CASE == (map & bitMask)) {
        bitMask = bitMask << 1;
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? defaultValues[idx] : reader.readPackedInt();
    } else {
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? defaultValues[idx] : reader.readPackedInt();
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:9,代码来源:PhastDecoder.java


示例13: decodeDeltaInt

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static int decodeDeltaInt(int[] intDictionary, ChannelReader reader, long map, int idx, long bitMask, Boolean isOptional) {
    if (isOptional && MOST_FREQUENT_CASE == (map & bitMask)) {
        bitMask = bitMask << 1;
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? (intDictionary[idx] += reader.readPackedInt()) : intDictionary[idx];
    } else {
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? (intDictionary[idx] += reader.readPackedInt()) : intDictionary[idx];
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:9,代码来源:PhastDecoder.java


示例14: decodeCopyInt

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static int decodeCopyInt(int[] intDictionary, ChannelReader reader, long map, int idx, long bitMask, Boolean isOptional) {
    if (isOptional && MOST_FREQUENT_CASE == (map & bitMask)) {
        bitMask = bitMask << 1;
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? intDictionary[idx] : (intDictionary[idx] = reader.readPackedInt());
    } else {
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? intDictionary[idx] : (intDictionary[idx] = reader.readPackedInt());
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:9,代码来源:PhastDecoder.java


示例15: decodePresentInt

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static int decodePresentInt(ChannelReader reader, long map, long bitMask, Boolean isOptional){
    if (isOptional && MOST_FREQUENT_CASE == (map & bitMask)) {
        bitMask = bitMask << 1;
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? reader.readPackedInt() : null;
    } else {
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? reader.readPackedInt() : null;
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:9,代码来源:PhastDecoder.java


示例16: decodeString

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static String decodeString(ChannelReader reader, Boolean isOptional){
	if (reader.readPackedInt() == INCOMING_VARIABLE){
		return reader.readUTF();
	}
	else
		return null;
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:8,代码来源:PhastDecoder.java


示例17: decodePresentLong

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static long decodePresentLong(ChannelReader reader, long map, long bitMask, Boolean isOptional){
    if (isOptional && MOST_FREQUENT_CASE == (map & bitMask)) {
        bitMask = bitMask << 1;
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? reader.readPackedLong() : null;
    } else {
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? reader.readPackedLong() : null;
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:9,代码来源:PhastDecoder.java


示例18: decodeDefaultLong

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static long decodeDefaultLong(ChannelReader reader, long map, long[] defaultValues, long bitMask, int idx, Boolean isOptional) {
   if (isOptional && MOST_FREQUENT_CASE == (map & bitMask)) {
       bitMask = bitMask << 1;
       return (MOST_FREQUENT_CASE == (map & bitMask)) ? defaultValues[idx] : reader.readPackedLong();
   } else {
       return (MOST_FREQUENT_CASE == (map & bitMask)) ? defaultValues[idx] : reader.readPackedLong();
   }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:9,代码来源:PhastDecoder.java


示例19: decodeCopyLong

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static long decodeCopyLong(long[] longDictionary, ChannelReader reader, long map, int idx, long bitMask, Boolean isOptional) {
    if (isOptional && MOST_FREQUENT_CASE == (map & bitMask)) {
        bitMask = bitMask << 1;
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? longDictionary[idx] : (longDictionary[idx] = reader.readPackedLong());
    } else {
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? longDictionary[idx] : (longDictionary[idx] = reader.readPackedLong());
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:9,代码来源:PhastDecoder.java


示例20: decodePresentShort

import com.ociweb.pronghorn.pipe.ChannelReader; //导入依赖的package包/类
public static short decodePresentShort(ChannelReader reader, long map, long bitMask, Boolean isOptional){
    if (isOptional && MOST_FREQUENT_CASE == (map & bitMask)) {
        bitMask = bitMask << 1;
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? reader.readPackedShort() : null;
    } else {
        return (MOST_FREQUENT_CASE == (map & bitMask)) ? reader.readPackedShort() : null;
    }
}
 
开发者ID:oci-pronghorn,项目名称:Pronghorn,代码行数:9,代码来源:PhastDecoder.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ListColumnVector类代码示例发布时间:2022-05-22
下一篇:
Java JRQueryChunk类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap