本文整理汇总了Java中com.ociweb.pronghorn.pipe.ChannelReader.hasRemainingBytes方法的典型用法代码示例。如果您正苦于以下问题:Java ChannelReader.hasRemainingBytes方法的具体用法?Java ChannelReader.hasRemainingBytes怎么用?Java ChannelReader.hasRemainingBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ociweb.pronghorn.pipe.ChannelReader
的用法示例。
在下文中一共展示了ChannelReader.hasRemainingBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: message
import com.ociweb.pronghorn.pipe.ChannelReader; //导入方法依赖的package包/类
@Override
public int message(ChannelReader reader) {
System.out.println("SerialReader's message function is being triggered");
int index = 0;
while (reader.hasRemainingBytes()){
try {
input[index++] = reader.readChar();
} catch (IOException e) {
e.printStackTrace();
}
}
printMsg(index);
l.coordinates(1, 2);
return index;
}
示例2: storeFields
import com.ociweb.pronghorn.pipe.ChannelReader; //导入方法依赖的package包/类
private void storeFields(ChannelReader reader) {
//These asserts are required to ensure no one refactors the TypeMask to modify
//the order value of these constants.
assert(TypeMask.IntegerSigned == 0x02);// integer
assert(TypeMask.LongSigned == 0x06);// integer
assert(TypeMask.TextUTF8 == 0x0A);// bytes
assert(TypeMask.Decimal == 0x0C);// decimal
assert(TypeMask.ByteVector == 0x0E);// bytes
assert(TypeMask.Rational == 0x1A);// rational
while (reader.hasRemainingBytes()) {
//////////////
//read type
////////////
int token = reader.readPackedInt();
int type = TokenBuilder.extractType(token);
int fieldId = TokenBuilder.extractId(token);
///////////
//read name length
//////////
int fieldNameLength = reader.readShort();
assert(fieldNameLength == -1);
//////////
//consume type
//////////
FieldConsumer[] localConsumers = consumers[fieldId];
int i;
if (null != localConsumers && ((i=localConsumers.length)>0)) {
int p = DataInputBlobReader.absolutePosition((DataInputBlobReader)reader);//keep this position so we can roll-back reader each time.
while (--i >= 0) {
DataInputBlobReader.absolutePosition((DataInputBlobReader)reader,p);
storeValue(reader, type, localConsumers[i]);
}
} else {
skipValue(reader, type);
}
}
}