本文整理了Java中okio.BufferedSource.readLong()
方法的一些代码示例,展示了BufferedSource.readLong()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferedSource.readLong()
方法的具体详情如下:
包路径:okio.BufferedSource
类名称:BufferedSource
方法名:readLong
[英]Removes eight bytes from this source and returns a big-endian long.
[中]从该源中删除八个字节,并返回一个big-endian-long。
代码示例来源:origin: square/okio
@Test public void readLong() throws Exception {
sink.write(new byte[] {
(byte) 0xab, (byte) 0xcd, (byte) 0xef, (byte) 0x10, (byte) 0x87, (byte) 0x65, (byte) 0x43,
(byte) 0x21, (byte) 0x36, (byte) 0x47, (byte) 0x58, (byte) 0x69, (byte) 0x12, (byte) 0x23,
(byte) 0x34, (byte) 0x45
});
sink.emit();
assertEquals(0xabcdef1087654321L, source.readLong());
assertEquals(0x3647586912233445L, source.readLong());
assertTrue(source.exhausted());
}
代码示例来源:origin: square/okhttp
frameLength = source.readLong();
if (frameLength < 0) {
throw new ProtocolException(
代码示例来源:origin: square/okio
@Test public void readLongTooShortThrows() throws IOException {
sink.writeLong(Long.MAX_VALUE);
sink.emit();
source.readByte();
try {
source.readLong();
fail();
} catch (EOFException expected) {
}
}
代码示例来源:origin: com.squareup.okhttp3/okhttp
frameLength = source.readLong();
if (frameLength < 0) {
throw new ProtocolException(
代码示例来源:origin: square/okio
@Test public void readLongSplitAcrossMultipleSegments() throws Exception {
sink.writeUtf8(repeat('a', SEGMENT_SIZE - 7));
sink.write(new byte[] {
(byte) 0xab, (byte) 0xcd, (byte) 0xef, (byte) 0x01, (byte) 0x87, (byte) 0x65, (byte) 0x43,
(byte) 0x21,
});
sink.emit();
source.skip(SEGMENT_SIZE - 7);
assertEquals(0xabcdef0187654321L, source.readLong());
assertTrue(source.exhausted());
}
代码示例来源:origin: com.squareup.okhttp/okhttp-ws
frameLength = source.readLong();
if (frameLength < 0) {
throw new ProtocolException(
代码示例来源:origin: com.squareup.okhttp3/okhttp-ws
frameLength = source.readLong();
if (frameLength < 0) {
throw new ProtocolException(
代码示例来源:origin: com.github.ljun20160606/okhttp
frameLength = source.readLong();
if (frameLength < 0) {
throw new ProtocolException(
代码示例来源:origin: apache/servicemix-bundles
frameLength = source.readLong();
if (frameLength < 0) {
throw new ProtocolException(
内容来源于网络,如有侵权,请联系作者删除!