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

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

本文整理了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

  1. void read() throws IOException {
  2. raf.seek(offset);
  3. major = raf.readInt();
  4. minor = raf.readInt();
  5. release = raf.readInt();
  6. name = raf.readStringMax(length - 12);
  7. }

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

  1. protected void read() throws IOException {
  2. raf.seek(offset);
  3. major = raf.readInt();
  4. minor = raf.readInt();
  5. release = raf.readInt();
  6. name = raf.readStringMax(length - 12);
  7. }

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

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

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

  1. void read() throws IOException {
  2. length = raf.readInt();
  3. first_len = raf.readInt();
  4. blk_len = raf.readShort(); // note size wrong in doc
  5. num_blk = raf.readShort(); // note size wrong in doc
  6. link_ref = raf.readShort();
  7. }

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

  1. void read() throws IOException {
  2. length = raf.readInt();
  3. first_len = raf.readInt();
  4. blk_len = raf.readShort(); // note size wrong in doc
  5. num_blk = raf.readShort(); // note size wrong in doc
  6. link_ref = raf.readShort();
  7. }

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

  1. Record5() throws IOException {
  2. nameHash = raf.readInt();
  3. raf.readFully(heapId);
  4. if (debugBtree2)
  5. debugOut.println(" record5 nameHash=" + nameHash + " heapId=" + Misc.showBytes(heapId));
  6. }
  7. }

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

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

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

  1. Record5() throws IOException {
  2. nameHash = raf.readInt();
  3. raf.read(heapId);
  4. if (debugBtree2)
  5. debugOut.println(" record5 nameHash=" + nameHash + " heapId=" + Misc.showBytes(heapId));
  6. }
  7. }

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

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

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

  1. Record9() throws IOException {
  2. raf.read(heapId);
  3. flags = raf.readByte();
  4. creationOrder = raf.readInt();
  5. }
  6. }

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

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

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

  1. Record4() throws IOException {
  2. hugeObjectAddress = h5.readOffset();
  3. hugeObjectLength = h5.readLength();
  4. filterMask = raf.readInt();
  5. hugeObjectSize = h5.readLength();
  6. }
  7. }

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

  1. Record4() throws IOException {
  2. hugeObjectAddress = h5.readOffset();
  3. hugeObjectLength = h5.readLength();
  4. filterMask = raf.readInt();
  5. hugeObjectSize = h5.readLength();
  6. }
  7. }

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

  1. void read() throws IOException {
  2. raf.seek(offset);
  3. xdim = raf.readInt();
  4. ydim = raf.readInt();
  5. raf.skipBytes(2);
  6. nt_ref = raf.readShort();
  7. nelems = raf.readShort();
  8. interlace = raf.readShort();
  9. compress = raf.readShort();
  10. compress_ref = raf.readShort();
  11. }

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

  1. void read() throws IOException {
  2. raf.seek(offset);
  3. xdim = raf.readInt();
  4. ydim = raf.readInt();
  5. raf.skipBytes(2);
  6. nt_ref = raf.readShort();
  7. nelems = raf.readShort();
  8. interlace = raf.readShort();
  9. compress = raf.readShort();
  10. compress_ref = raf.readShort();
  11. }

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

  1. protected void read() throws IOException {
  2. raf.seek(offset);
  3. xdim = raf.readInt();
  4. ydim = raf.readInt();
  5. raf.skipBytes(2);
  6. nt_ref = raf.readShort();
  7. nelems = raf.readShort();
  8. interlace = raf.readShort();
  9. compress = raf.readShort();
  10. compress_ref = raf.readShort();
  11. }

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

  1. private void readHeader() throws IOException {
  2. raf.seek(32);
  3. raf.order(ByteOrder.LITTLE_ENDIAN);
  4. int itype = raf.readInt();
  5. type = assignType(itype);
  6. bb = readBoundingBox();
  7. }

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

  1. private void readHeader() throws IOException {
  2. raf.seek(32);
  3. raf.order(ByteOrder.LITTLE_ENDIAN);
  4. int itype = raf.readInt();
  5. type = assignType(itype);
  6. bb = readBoundingBox();
  7. }

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

  1. private void readHeader() throws IOException {
  2. raf.seek(32);
  3. raf.order(ByteOrder.LITTLE_ENDIAN);
  4. int itype = raf.readInt();
  5. type = assignType(itype);
  6. bb = readBoundingBox();
  7. }

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

  1. Record2() throws IOException {
  2. hugeObjectAddress = h5.readOffset();
  3. hugeObjectLength = h5.readLength();
  4. filterMask = raf.readInt();
  5. hugeObjectSize = h5.readLength();
  6. hugeObjectID = h5.readLength();
  7. }
  8. }

相关文章