okio.Buffer.readLong()方法的使用及代码示例

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

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

Buffer.readLong介绍

暂无

代码示例

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

/**
 * Creates a relay that reads a recorded stream from {@code file}.
 *
 * <p><strong>Warning:</strong> callers to this method must immediately call {@link #newSource} to
 * create a source and close that when they're done. Otherwise a handle to {@code file} will be
 * leaked.
 */
public static Relay read(File file) throws IOException {
 RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
 FileOperator fileOperator = new FileOperator(randomAccessFile.getChannel());
 // Read the header.
 Buffer header = new Buffer();
 fileOperator.read(0, header, FILE_HEADER_SIZE);
 ByteString prefix = header.readByteString(PREFIX_CLEAN.size());
 if (!prefix.equals(PREFIX_CLEAN)) throw new IOException("unreadable cache file");
 long upstreamSize = header.readLong();
 long metadataSize = header.readLong();
 // Read the metadata.
 Buffer metadataBuffer = new Buffer();
 fileOperator.read(FILE_HEADER_SIZE + upstreamSize, metadataBuffer, metadataSize);
 ByteString metadata = metadataBuffer.readByteString();
 // Return the result.
 return new Relay(randomAccessFile, null, upstreamSize, metadata, 0L);
}

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

/**
 * Creates a relay that reads a recorded stream from {@code file}.
 *
 * <p><strong>Warning:</strong> callers to this method must immediately call {@link #newSource} to
 * create a source and close that when they're done. Otherwise a handle to {@code file} will be
 * leaked.
 */
public static Relay read(File file) throws IOException {
 RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
 FileOperator fileOperator = new FileOperator(randomAccessFile.getChannel());
 // Read the header.
 Buffer header = new Buffer();
 fileOperator.read(0, header, FILE_HEADER_SIZE);
 ByteString prefix = header.readByteString(PREFIX_CLEAN.size());
 if (!prefix.equals(PREFIX_CLEAN)) throw new IOException("unreadable cache file");
 long upstreamSize = header.readLong();
 long metadataSize = header.readLong();
 // Read the metadata.
 Buffer metadataBuffer = new Buffer();
 fileOperator.read(FILE_HEADER_SIZE + upstreamSize, metadataBuffer, metadataSize);
 ByteString metadata = metadataBuffer.readByteString();
 // Return the result.
 return new Relay(randomAccessFile, null, upstreamSize, metadata, 0L);
}

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

@Override public long readLong() throws IOException {
 require(8);
 return buffer.readLong();
}

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

@Override public long readLongLe() {
 return Util.reverseBytesLong(readLong());
}

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

/**
 * Creates a relay that reads a recorded stream from {@code file}.
 *
 * <p><strong>Warning:</strong> callers to this method must immediately call {@link #newSource} to
 * create a source and close that when they're done. Otherwise a handle to {@code file} will be
 * leaked.
 */
public static Relay read(File file) throws IOException {
 RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
 FileOperator fileOperator = new FileOperator(randomAccessFile.getChannel());
 // Read the header.
 Buffer header = new Buffer();
 fileOperator.read(0, header, FILE_HEADER_SIZE);
 ByteString prefix = header.readByteString(PREFIX_CLEAN.size());
 if (!prefix.equals(PREFIX_CLEAN)) throw new IOException("unreadable cache file");
 long upstreamSize = header.readLong();
 long metadataSize = header.readLong();
 // Read the metadata.
 Buffer metadataBuffer = new Buffer();
 fileOperator.read(FILE_HEADER_SIZE + upstreamSize, metadataBuffer, metadataSize);
 ByteString metadata = metadataBuffer.readByteString();
 // Return the result.
 return new Relay(randomAccessFile, null, upstreamSize, metadata, 0L);
}

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

/**
 * Creates a relay that reads a recorded stream from {@code file}.
 *
 * <p><strong>Warning:</strong> callers to this method must immediately call {@link #newSource} to
 * create a source and close that when they're done. Otherwise a handle to {@code file} will be
 * leaked.
 */
public static Relay read(File file) throws IOException {
 RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
 FileOperator fileOperator = new FileOperator(randomAccessFile.getChannel());
 // Read the header.
 Buffer header = new Buffer();
 fileOperator.read(0, header, FILE_HEADER_SIZE);
 ByteString prefix = header.readByteString(PREFIX_CLEAN.size());
 if (!prefix.equals(PREFIX_CLEAN)) throw new IOException("unreadable cache file");
 long upstreamSize = header.readLong();
 long metadataSize = header.readLong();
 // Read the metadata.
 Buffer metadataBuffer = new Buffer();
 fileOperator.read(FILE_HEADER_SIZE + upstreamSize, metadataBuffer, metadataSize);
 ByteString metadata = metadataBuffer.readByteString();
 // Return the result.
 return new Relay(randomAccessFile, null, upstreamSize, metadata, 0L);
}

相关文章