okio.BufferedSource.readShort()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中okio.BufferedSource.readShort()方法的一些代码示例,展示了BufferedSource.readShort()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferedSource.readShort()方法的具体详情如下:
包路径:okio.BufferedSource
类名称:BufferedSource
方法名:readShort

BufferedSource.readShort介绍

[英]Removes two bytes from this source and returns a big-endian short.
[中]从此源中删除两个字节并返回一个大端短端。

代码示例

代码示例来源:origin: square/okio

@Test public void readShort() throws Exception {
 sink.write(new byte[] {
   (byte) 0xab, (byte) 0xcd, (byte) 0xef, (byte) 0x01
 });
 sink.emit();
 assertEquals((short) 0xabcd, source.readShort());
 assertEquals((short) 0xef01, source.readShort());
 assertTrue(source.exhausted());
}

代码示例来源:origin: huxq17/tractor

if (fhcrc) updateCrc(source.buffer(), 0, 10);
short id1id2 = source.readShort();
checkEqual("ID1ID2", (short) 0x1f8b, id1id2);
source.skip(8);

代码示例来源:origin: square/okhttp

frameLength = source.readShort() & 0xffffL; // Value is unsigned.
} else if (frameLength == PAYLOAD_LONG) {
 frameLength = source.readLong();

代码示例来源:origin: square/okio

throw new ProtocolException();
int port = fromSource.readShort() & 0xffff;

代码示例来源:origin: square/okio

@Test public void readShortTooShortThrows() throws IOException {
 sink.writeShort(Short.MAX_VALUE);
 sink.emit();
 source.readByte();
 try {
  source.readShort();
  fail();
 } catch (EOFException expected) {
 }
}

代码示例来源:origin: square/okhttp

Settings settings = new Settings();
for (int i = 0; i < length; i += 6) {
 int id = source.readShort() & 0xFFFF;
 int value = source.readInt();

代码示例来源:origin: square/okio

@Test public void readShortSplitAcrossMultipleSegments() throws Exception {
 sink.writeUtf8(repeat('a', SEGMENT_SIZE - 1));
 sink.write(new byte[] { (byte) 0xab, (byte) 0xcd });
 sink.emit();
 source.skip(SEGMENT_SIZE - 1);
 assertEquals((short) 0xabcd, source.readShort());
 assertTrue(source.exhausted());
}

代码示例来源:origin: com.squareup.okhttp3/okhttp

frameLength = source.readShort() & 0xffffL; // Value is unsigned.
} else if (frameLength == PAYLOAD_LONG) {
 frameLength = source.readLong();

代码示例来源:origin: com.squareup.okhttp3/okhttp

Settings settings = new Settings();
for (int i = 0; i < length; i += 6) {
 int id = source.readShort() & 0xFFFF;
 int value = source.readInt();

代码示例来源:origin: huxq17/SwipeCardsView

private void readSynStream(Handler handler, int flags, int length) throws IOException {
 int w1 = source.readInt();
 int w2 = source.readInt();
 int streamId = w1 & 0x7fffffff;
 int associatedStreamId = w2 & 0x7fffffff;
 source.readShort(); // int priority = (s3 & 0xe000) >>> 13; int slot = s3 & 0xff;
 List<Header> headerBlock = headerBlockReader.readNameValueBlock(length - 10);
 boolean inFinished = (flags & FLAG_FIN) != 0;
 boolean outFinished = (flags & FLAG_UNIDIRECTIONAL) != 0;
 handler.headers(outFinished, inFinished, streamId, associatedStreamId, headerBlock,
   HeadersMode.SPDY_SYN_STREAM);
}

代码示例来源:origin: huxq17/tractor

private void readSynStream(Handler handler, int flags, int length) throws IOException {
 int w1 = source.readInt();
 int w2 = source.readInt();
 int streamId = w1 & 0x7fffffff;
 int associatedStreamId = w2 & 0x7fffffff;
 source.readShort(); // int priority = (s3 & 0xe000) >>> 13; int slot = s3 & 0xff;
 List<Header> headerBlock = headerBlockReader.readNameValueBlock(length - 10);
 boolean inFinished = (flags & FLAG_FIN) != 0;
 boolean outFinished = (flags & FLAG_UNIDIRECTIONAL) != 0;
 handler.headers(outFinished, inFinished, streamId, associatedStreamId, headerBlock,
   HeadersMode.SPDY_SYN_STREAM);
}

代码示例来源:origin: duzechao/OKHttpUtils

private void readSynStream(Handler handler, int flags, int length) throws IOException {
 int w1 = source.readInt();
 int w2 = source.readInt();
 int streamId = w1 & 0x7fffffff;
 int associatedStreamId = w2 & 0x7fffffff;
 source.readShort(); // int priority = (s3 & 0xe000) >>> 13; int slot = s3 & 0xff;
 List<Header> headerBlock = headerBlockReader.readNameValueBlock(length - 10);
 boolean inFinished = (flags & FLAG_FIN) != 0;
 boolean outFinished = (flags & FLAG_UNIDIRECTIONAL) != 0;
 handler.headers(outFinished, inFinished, streamId, associatedStreamId, headerBlock,
   HeadersMode.SPDY_SYN_STREAM);
}

代码示例来源:origin: com.squareup.okhttp3/okhttp-ws

frameLength = source.readShort() & 0xffffL; // Value is unsigned.
} else if (frameLength == PAYLOAD_LONG) {
 frameLength = source.readLong();

代码示例来源:origin: com.squareup.okhttp/okhttp-ws

frameLength = source.readShort() & 0xffffL; // Value is unsigned.
} else if (frameLength == PAYLOAD_LONG) {
 frameLength = source.readLong();

代码示例来源:origin: duzechao/OKHttpUtils

Settings settings = new Settings();
for (int i = 0; i < length; i += 6) {
 short id = source.readShort();
 int value = source.readInt();

代码示例来源:origin: huxq17/tractor

Settings settings = new Settings();
for (int i = 0; i < length; i += 6) {
 short id = source.readShort();
 int value = source.readInt();

代码示例来源:origin: com.github.ljun20160606/okhttp

frameLength = source.readShort() & 0xffffL; // Value is unsigned.
} else if (frameLength == PAYLOAD_LONG) {
 frameLength = source.readLong();

代码示例来源:origin: huxq17/SwipeCardsView

Settings settings = new Settings();
for (int i = 0; i < length; i += 6) {
 short id = source.readShort();
 int value = source.readInt();

代码示例来源:origin: com.github.ljun20160606/okhttp

Settings settings = new Settings();
for (int i = 0; i < length; i += 6) {
 int id = source.readShort() & 0xFFFF;
 int value = source.readInt();

代码示例来源:origin: apache/servicemix-bundles

Settings settings = new Settings();
for (int i = 0; i < length; i += 6) {
 int id = source.readShort() & 0xFFFF;
 int value = source.readInt();

相关文章

微信公众号

最新文章

更多