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

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

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

RandomAccessFile.readInt介绍

[英]Reads a signed 32-bit integer from this file. This method reads 4 bytes from the file. If the bytes read, in order, are b1, b2, b3, and b4, where 0 <= b1, b2, b3, b4 <= 255, then the result is equal to:

(b1 << 24) | (b2 << 16) + (b3 << 8) + b4

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.
[中]从该文件中读取带符号的32位整数。此方法从文件中读取4个字节。如果按顺序读取的字节为b1b2b3b4,其中0 <= b1, b2, b3, b4 <= 255,则结果等于:
(b1 << 24) | (b2 << 16) + (b3 << 8) + b4
此方法会一直阻塞,直到读取了四个字节、检测到流结束或引发异常为止。

代码示例

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

void read() throws IOException {
 raf.seek(offset);
 major = raf.readInt();
 minor = raf.readInt();
 release = raf.readInt();
 name = raf.readStringMax(length - 12);
}

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

protected void read() throws IOException {
 raf.seek(offset);
 major = raf.readInt();
 minor = raf.readInt();
 release = raf.readInt();
 name = raf.readStringMax(length - 12);
}

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

void read() throws IOException {
 size = raf.readInt();
 value = new byte[size];
 raf.readFully(value);
 if (debug1) debugOut.println(this);
}

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

void read() throws IOException {
 length = raf.readInt();
 first_len = raf.readInt();
 blk_len = raf.readShort(); // note size wrong in doc
 num_blk = raf.readShort(); // note size wrong in doc
 link_ref = raf.readShort();
}

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

void read() throws IOException {
 length = raf.readInt();
 first_len = raf.readInt();
 blk_len = raf.readShort(); // note size wrong in doc
 num_blk = raf.readShort(); // note size wrong in doc
 link_ref = raf.readShort();
}

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

Record5() throws IOException {
  nameHash = raf.readInt();
  raf.readFully(heapId);
  if (debugBtree2)
   debugOut.println("  record5 nameHash=" + nameHash + " heapId=" + Misc.showBytes(heapId));
 }
}

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

private int readVariableSize(int size) throws IOException {
 long vv;
 if (size == 1) {
  return raf.readByte();
 } else if (size == 2) {
  return raf.readShort();
 } else if (size == 4) {
  return raf.readInt();
 }
 throw new IllegalArgumentException("Dont support int size == " + size);
}

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

Record5() throws IOException {
  nameHash = raf.readInt();
  raf.read(heapId);
  if (debugBtree2)
   debugOut.println("  record5 nameHash=" + nameHash + " heapId=" + Misc.showBytes(heapId));
 }
}

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

private int readVariableSize(int size) throws IOException {
 long vv;
 if (size == 1) {
  return raf.readByte();
 } else if (size == 2) {
  return raf.readShort();
 } else if (size == 4) {
  return raf.readInt();
 }
 throw new IllegalArgumentException("Dont support int size == " + size);
}

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

Record9() throws IOException {
  raf.read(heapId);
  flags = raf.readByte();
  creationOrder = raf.readInt();
 }
}

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

HeapIdentifier(long address) throws IOException {
 // header information is in le byte order
 raf.order(RandomAccessFile.LITTLE_ENDIAN);
 raf.seek(address);
 nelems = raf.readInt();
 heapAddress = readOffset();
 index = raf.readInt();
 if (debugDetail)
  debugOut.println("   read HeapIdentifier address=" + address + this);
 if (debugHeap) dump("heapIdentifier", getFileOffset(address), 16, true);
}

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

Record4() throws IOException {
  hugeObjectAddress = h5.readOffset();
  hugeObjectLength = h5.readLength();
  filterMask = raf.readInt();
  hugeObjectSize = h5.readLength();
 }
}

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

Record4() throws IOException {
  hugeObjectAddress = h5.readOffset();
  hugeObjectLength = h5.readLength();
  filterMask = raf.readInt();
  hugeObjectSize = h5.readLength();
 }
}

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

void read() throws IOException {
 raf.seek(offset);
 xdim = raf.readInt();
 ydim = raf.readInt();
 raf.skipBytes(2);
 nt_ref = raf.readShort();
 nelems = raf.readShort();
 interlace = raf.readShort();
 compress = raf.readShort();
 compress_ref = raf.readShort();
}

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

void read() throws IOException {
 raf.seek(offset);
 xdim = raf.readInt();
 ydim = raf.readInt();
 raf.skipBytes(2);
 nt_ref = raf.readShort();
 nelems = raf.readShort();
 interlace = raf.readShort();
 compress = raf.readShort();
 compress_ref = raf.readShort();
}

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

protected void read() throws IOException {
 raf.seek(offset);
 xdim = raf.readInt();
 ydim = raf.readInt();
 raf.skipBytes(2);
 nt_ref = raf.readShort();
 nelems = raf.readShort();
 interlace = raf.readShort();
 compress = raf.readShort();
 compress_ref = raf.readShort();
}

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

private void readHeader() throws IOException {
 raf.seek(32);
 raf.order(ByteOrder.LITTLE_ENDIAN);
 int itype = raf.readInt();
 type = assignType(itype);
 bb = readBoundingBox();
}

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

private void readHeader() throws IOException {
 raf.seek(32);
 raf.order(ByteOrder.LITTLE_ENDIAN);
 int itype = raf.readInt();
 type = assignType(itype);
 bb = readBoundingBox();
}

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

private void readHeader() throws IOException {
 raf.seek(32);
 raf.order(ByteOrder.LITTLE_ENDIAN);
 int itype = raf.readInt();
 type = assignType(itype);
 bb = readBoundingBox();
}

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

Record2() throws IOException {
  hugeObjectAddress = h5.readOffset();
  hugeObjectLength = h5.readLength();
  filterMask = raf.readInt();
  hugeObjectSize = h5.readLength();
  hugeObjectID = h5.readLength();
 }
}

相关文章