本文整理汇总了Java中com.koushikdutta.async.DataEmitter.setDataCallback方法的典型用法代码示例。如果您正苦于以下问题:Java DataEmitter.setDataCallback方法的具体用法?Java DataEmitter.setDataCallback怎么用?Java DataEmitter.setDataCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.koushikdutta.async.DataEmitter
的用法示例。
在下文中一共展示了DataEmitter.setDataCallback方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDataAvailable
import com.koushikdutta.async.DataEmitter; //导入方法依赖的package包/类
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
bb.order(ByteOrder.BIG_ENDIAN);
w1 = bb.getInt();
w2 = bb.getInt();
boolean control = (w1 & 0x80000000) != 0;
flags = (w2 & 0xff000000) >>> 24;
length = (w2 & 0xffffff);
if (!control) {
streamId = w1 & 0x7fffffff;
inFinished = (flags & FLAG_FIN) != 0;
emitter.setDataCallback(onDataFrame);
if (length == 0) {
// zero length packet, immediately trigger the data parsing
// fixes the hanging response portion of https://github.com/koush/ion/issues/443#issuecomment-67729152
onDataFrame.onDataAvailable(emitter, emptyList);
}
}
else {
reader.read(length, onFullFrame);
}
}
示例2: HybiParser
import com.koushikdutta.async.DataEmitter; //导入方法依赖的package包/类
public HybiParser(DataEmitter socket) {
socket.setDataCallback(mReader);
parse();
}
示例3: parse
import com.koushikdutta.async.DataEmitter; //导入方法依赖的package包/类
@Override
public void parse(DataEmitter emitter, CompletedCallback completed) {
this.emitter = emitter;
emitter.setEndCallback(completed);
emitter.setDataCallback(new DataCallback.NullDataCallback());
}