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

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

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

RandomAccessFile.readFloat介绍

[英]Reads a float from this file. This method reads an int value as if by the readInt method and then converts that int to a float using the intBitsToFloat method in class Float.

This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.
[中]从该文件中读取float。此方法读取int值,就像通过readInt方法一样,然后使用类Float中的intBitsToFloat方法将int转换为float
此方法会一直阻塞,直到读取了四个字节、检测到流结束或引发异常为止。

代码示例

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

  1. private float getDataBlockValue1(RandomAccessFile raf, short offset, int skip) throws IOException {
  2. long off = offset + message_offset + MESSAGE_HEADER_SIZE;
  3. raf.seek(off);
  4. raf.skipBytes(skip);
  5. return raf.readFloat();
  6. }

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

  1. private float getDataBlockValue1(RandomAccessFile raf, short offset, int skip) throws IOException {
  2. long off = offset + message_offset + MESSAGE_HEADER_SIZE;
  3. raf.seek(off);
  4. raf.skipBytes(skip);
  5. return raf.readFloat();
  6. }

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

  1. private float getDataBlockValue1(RandomAccessFile raf, short offset, int skip) throws IOException {
  2. long off = offset + message_offset + MESSAGE_HEADER_SIZE;
  3. raf.seek(off);
  4. raf.skipBytes(skip);
  5. return raf.readFloat();
  6. }

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

  1. Type0(RandomAccessFile raf) throws IOException {
  2. this.referenceValue = raf.readFloat();
  3. this.binaryScaleFactor = GribNumbers.int2(raf);
  4. this.decimalScaleFactor = GribNumbers.int2(raf);
  5. this.numberOfBits = raf.read();
  6. this.originalType = raf.read();
  7. }

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

  1. Type2(RandomAccessFile raf) throws IOException {
  2. super(raf);
  3. this.splittingMethod = raf.read();
  4. this.missingValueManagement = raf.read();
  5. this.primaryMissingValue = raf.readFloat();
  6. this.secondaryMissingValue = raf.readFloat();
  7. this.numberOfGroups = GribNumbers.int4(raf);
  8. this.referenceGroupWidths = raf.read();
  9. this.bitsGroupWidths = raf.read();
  10. this.referenceGroupLength = GribNumbers.int4(raf);
  11. this.lengthIncrement = raf.read();
  12. this.lengthLastGroup = GribNumbers.int4(raf);
  13. this.bitsScaledGroupLength = raf.read();
  14. }

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

  1. Object readFloatArray1D(int offsetInRecord) throws IOException {
  2. int elementSizeInBytes = 4;
  3. float[] array = new float[header.getNumDataRecords()];
  4. this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
  5. for (int i = 0; i < header.getNumDataRecords(); i++) {
  6. this.raf.readFloat(array, i, 1);
  7. this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
  8. }
  9. return (array);
  10. }

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

  1. Object readFloatArray1D(int offsetInRecord) throws IOException {
  2. int elementSizeInBytes = 4;
  3. float[] array = new float[header.getNumDataRecords()];
  4. this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
  5. for (int i = 0; i < header.getNumDataRecords(); i++) {
  6. this.raf.readFloat(array, i, 1);
  7. this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
  8. }
  9. return (array);
  10. }

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

  1. Object readFloatArray1D(int offsetInRecord) throws IOException {
  2. int elementSizeInBytes = 4;
  3. float[] array = new float[header.getNumDataRecords()];
  4. this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
  5. for (int i = 0; i < header.getNumDataRecords(); i++) {
  6. this.raf.readFloat(array, i, 1);
  7. this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
  8. }
  9. return (array);
  10. }

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

  1. dataFile.readFloat(data, 0, sizeX * sizeY);
  2. if (gradsDDF.isYReversed()) {
  3. int newLoc = 0;

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

  1. dataFile.readFloat(data, 0, sizeX * sizeY);
  2. if (gradsDDF.isYReversed()) {
  3. int newLoc = 0;

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

  1. dataFile.readFloat(data, 0, sizeX * sizeY);
  2. if (gradsDDF.isYReversed()) {
  3. int newLoc = 0;

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

  1. float f = raf.readFloat();

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

  1. float f = raf.readFloat();

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

  1. float f = raf.readFloat();

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

  1. float[] pa = new float[heapId.nelems];
  2. raf.seek(ho.dataPos);
  3. raf.readFloat(pa, 0, pa.length);
  4. return Array.factory(dataType, new int[]{pa.length}, pa);

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

  1. float[] pa = new float[heapId.nelems];
  2. raf.seek(ho.dataPos);
  3. raf.readFloat(pa, 0, pa.length);
  4. return Array.factory(dataType.getPrimitiveClassType(), new int[]{pa.length}, pa);

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

  1. float[] pa = new float[heapId.nelems];
  2. raf.seek(ho.dataPos);
  3. raf.readFloat(pa, 0, pa.length);
  4. return Array.factory(dataType.getPrimitiveClassType(), new int[]{pa.length}, pa);

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

  1. Type50002(RandomAccessFile raf) throws IOException {
  2. this.referenceValue = raf.readFloat();
  3. this.binaryScaleFactor = GribNumbers.int2(raf);
  4. this.decimalScaleFactor = GribNumbers.int2(raf);

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

  1. raf.order(byteOrder);
  2. raf.seek(chunk.getSrcPos());
  3. raf.readFloat(pa, (int) chunk.getDestElem(), chunk.getNelems());

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

  1. raf.order(byteOrder);
  2. raf.seek(chunk.getSrcPos());
  3. raf.readFloat(pa, (int) chunk.getDestElem(), chunk.getNelems());

相关文章