ucar.unidata.io.RandomAccessFile.read_()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(138)

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

RandomAccessFile.read_介绍

[英]Read directly from file, without going through the buffer. All reading goes through here or readToByteChannel;
[中]直接从文件中读取,无需经过缓冲区。所有阅读都通过这里或ReadToByte频道;

代码示例

代码示例来源:origin: edu.ucar/netcdf

/**
 * Read an integer at the given position, bypassing all buffering.
 *
 * @param pos read a byte at this position
 * @return The int that was read
 * @throws IOException if an I/O error occurs.
 */
public final int readIntUnbuffered(long pos) throws IOException {
 byte[] bb = new byte[4];
 read_(pos, bb, 0, 4);
 int ch1 = bb[0] & 0xff;
 int ch2 = bb[1] & 0xff;
 int ch3 = bb[2] & 0xff;
 int ch4 = bb[3] & 0xff;
 if ((ch1 | ch2 | ch3 | ch4) < 0) {
  throw new EOFException();
 }
 if (bigEndian) {
  return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4));
 } else {
  return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1));
 }
}

代码示例来源:origin: edu.ucar/unidataCommon

/**
 * Read an integer at the given position, bypassing all buffering.
 *
 * @param pos read a byte at this position
 * @return The int that was read
 * @throws IOException if an I/O error occurs.
 */
public final int readIntUnbuffered(long pos) throws IOException {
 byte[] bb = new byte[4];
 read_(pos, bb, 0, 4);
 int ch1 = bb[0] & 0xff;
 int ch2 = bb[1] & 0xff;
 int ch3 = bb[2] & 0xff;
 int ch4 = bb[3] & 0xff;
 if ((ch1 | ch2 | ch3 | ch4) < 0) {
  throw new EOFException();
 }
 if (bigEndian) {
  return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4));
 } else {
  return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1));
 }
}

代码示例来源:origin: edu.ucar/cdm

/**
 * Read an integer at the given position, bypassing all buffering.
 *
 * @param pos read a byte at this position
 * @return The int that was read
 * @throws IOException if an I/O error occurs.
 */
public final int readIntUnbuffered(long pos) throws IOException {
 byte[] bb = new byte[4];
 read_(pos, bb, 0, 4);
 int ch1 = bb[0] & 0xff;
 int ch2 = bb[1] & 0xff;
 int ch3 = bb[2] & 0xff;
 int ch4 = bb[3] & 0xff;
 if ((ch1 | ch2 | ch3 | ch4) < 0) {
  throw new EOFException();
 }
 if (bigEndian) {
  return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4));
 } else {
  return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1));
 }
}

代码示例来源:origin: Unidata/thredds

/**
 * Read an integer at the given position, bypassing all buffering.
 *
 * @param pos read a byte at this position
 * @return The int that was read
 * @throws IOException if an I/O error occurs.
 */
public final int readIntUnbuffered(long pos) throws IOException {
 byte[] bb = new byte[4];
 read_(pos, bb, 0, 4);
 int ch1 = bb[0] & 0xff;
 int ch2 = bb[1] & 0xff;
 int ch3 = bb[2] & 0xff;
 int ch4 = bb[3] & 0xff;
 if ((ch1 | ch2 | ch3 | ch4) < 0) {
  throw new EOFException();
 }
 if (bigEndian) {
  return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4));
 } else {
  return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1));
 }
}

代码示例来源:origin: edu.ucar/unidataCommon

protected void readBuffer(long pos) throws IOException {
 // If the current buffer is modified, write it to disk.
 if (bufferModified) {
  flush();
 }
 bufferStart = pos;
 filePosition = pos;
 dataSize = read_(pos, buffer, 0, buffer.length);
 if (dataSize <= 0) {
  dataSize = 0;
  endOfFile = true;
 } else {
  endOfFile = false;
 }
 // Cache the position of the buffer end.
 dataEnd = bufferStart + dataSize;
}

代码示例来源:origin: Unidata/thredds

protected void readBuffer(long pos) throws IOException {
 // If the current buffer is modified, write it to disk.
 if (bufferModified) {
  flush();
 }
 bufferStart = pos;
 filePosition = pos;
 dataSize = read_(pos, buffer, 0, buffer.length);
 if (dataSize <= 0) {
  dataSize = 0;
  endOfFile = true;
 } else {
  endOfFile = false;
 }
 // Cache the position of the buffer end.
 dataEnd = bufferStart + dataSize;
}

代码示例来源:origin: edu.ucar/cdm

protected void readBuffer(long pos) throws IOException {
 // If the current buffer is modified, write it to disk.
 if (bufferModified) {
  flush();
 }
 bufferStart = pos;
 filePosition = pos;
 dataSize = read_(pos, buffer, 0, buffer.length);
 if (dataSize <= 0) {
  dataSize = 0;
  endOfFile = true;
 } else {
  endOfFile = false;
 }
 // Cache the position of the buffer end.
 dataEnd = bufferStart + dataSize;
}

代码示例来源:origin: edu.ucar/netcdf

protected void readBuffer(long pos) throws IOException {
 // If the current buffer is modified, write it to disk.
 if (bufferModified) {
  flush();
 }
 bufferStart = pos;
 filePosition = pos;
 dataSize = read_(pos, buffer, 0, buffer.length);
 if (dataSize <= 0) {
  dataSize = 0;
  endOfFile = true;
 } else {
  endOfFile = false;
 }
 // Cache the position of the buffer end.
 dataEnd = bufferStart + dataSize;
}

代码示例来源:origin: edu.ucar/unidataCommon

extraCopy = read_(filePosition, b, off + copyLength, len - copyLength);

代码示例来源:origin: edu.ucar/cdm

extraCopy = read_(filePosition, b, off + copyLength, len - copyLength);

代码示例来源:origin: edu.ucar/netcdf

extraCopy = read_(filePosition, b, off + copyLength, len - copyLength);

代码示例来源:origin: Unidata/thredds

extraCopy = read_(filePosition, b, off + copyLength, len - copyLength);

相关文章