本文整理了Java中ucar.unidata.io.RandomAccessFile.order
方法的一些代码示例,展示了RandomAccessFile.order
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.order
方法的具体详情如下:
包路径:ucar.unidata.io.RandomAccessFile
类名称:RandomAccessFile
方法名:order
[英]Change the current endian mode. Subsequent reads of short, int, float, double, long, char will use this. Does not currently affect writes. Default values is BIG_ENDIAN.
[中]更改当前的endian模式。随后读取short、int、float、double、long和char将使用此选项。目前不影响写入。默认值是BIG_ENDIAN。
代码示例来源:origin: Unidata/thredds
public Grib2RecordScanner(RandomAccessFile raf) throws IOException {
this.raf = raf;
raf.seek(0);
raf.order(RandomAccessFile.BIG_ENDIAN);
lastPos = 0;
if (debugRepeat) System.out.printf(" Grib2RecordScanner %s%n", raf.getLocation());
}
代码示例来源:origin: Unidata/thredds
public Grib1RecordScanner(RandomAccessFile raf) throws IOException {
this.raf = raf;
raf.seek(0);
raf.order(RandomAccessFile.BIG_ENDIAN);
lastPos = 0;
}
代码示例来源:origin: edu.ucar/bufr
public MessageScanner(RandomAccessFile raf, long startPos) throws IOException {
startPos = (startPos < 30) ? 0 : startPos - 30; // look for the header
this.raf = raf;
raf.seek(startPos);
raf.order(RandomAccessFile.BIG_ENDIAN);
lastPos = startPos;
}
代码示例来源:origin: Unidata/thredds
public MessageScanner(RandomAccessFile raf, long startPos, boolean useEmbeddedTables) throws IOException {
startPos = (startPos < 30) ? 0 : startPos - 30; // look for the header
this.raf = raf;
lastPos = startPos;
this.useEmbeddedTables = useEmbeddedTables;
raf.seek(startPos);
raf.order(RandomAccessFile.BIG_ENDIAN);
}
代码示例来源:origin: Unidata/thredds
private Grib2RecordScanner(RandomAccessFile raf, long startFrom) throws IOException {
this.raf = raf;
raf.seek(startFrom);
raf.order(RandomAccessFile.BIG_ENDIAN);
lastPos = startFrom;
}
代码示例来源:origin: Unidata/thredds
public void reacquire() throws IOException {
raf = RandomAccessFile.acquire(location);
this.raf.order(rafOrder);
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Check if this is a valid SIGMET-IRIS file for this IOServiceProvider.
*/
public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) {
try {
raf.order(RandomAccessFile.LITTLE_ENDIAN);
raf.seek(24);
return (raf.readShort() == (short) 15);
} catch (IOException ioe) {
System.out.println("In isValidFile(): " + ioe.toString());
return false;
}
}
代码示例来源:origin: Unidata/thredds
@Override
public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) throws IOException {
// this is the first time we try to read the file - if there's a problem we get a IOException
raf.seek(0);
raf.order(ByteOrder.BIG_ENDIAN);
int fileCode = raf.readInt();
if (fileCode != MAGIC)
return false;
raf.seek(28);
raf.order(ByteOrder.LITTLE_ENDIAN);
int version = raf.readInt();
if (version != VERSION)
return false;
return true;
}
代码示例来源:origin: edu.ucar/cdm
@Override
public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) throws IOException {
// this is the first time we try to read the file - if there's a problem we get a IOException
raf.seek(0);
raf.order(ByteOrder.BIG_ENDIAN);
int fileCode = raf.readInt();
if (fileCode != MAGIC)
return false;
raf.seek(28);
raf.order(ByteOrder.LITTLE_ENDIAN);
int version = raf.readInt();
if (version != VERSION)
return false;
return true;
}
代码示例来源:origin: edu.ucar/netcdf
@Override
public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) throws IOException {
// this is the first time we try to read the file - if there's a problem we get a IOException
raf.seek(0);
raf.order(ByteOrder.BIG_ENDIAN);
int fileCode = raf.readInt();
if (fileCode != MAGIC)
return false;
raf.seek(28);
raf.order(ByteOrder.LITTLE_ENDIAN);
int version = raf.readInt();
if (version != VERSION)
return false;
return true;
}
代码示例来源:origin: edu.ucar/netcdf
private static void dump(String filename) throws IOException {
System.out.printf("Dump %s%n", filename);
RandomAccessFile raf = new RandomAccessFile(filename, "r");
NetcdfFile ncfile = new MyNetcdfFile();
// its a netcdf-3 file
raf.order(RandomAccessFile.BIG_ENDIAN);
N3header headerParser = new N3header();
headerParser.read(raf, ncfile, new Formatter(System.out));
raf.close();
}
代码示例来源: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: edu.ucar/netcdf
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
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: Unidata/thredds
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) {
log.debug(" read HeapIdentifier address=" + address + this);
}
if (debugHeap) dump("heapIdentifier", getFileOffset(address), 16, true);
}
代码示例来源:origin: Unidata/thredds
public Array readData(Variable v2, Section wantSection) throws IOException, InvalidRangeException {
// raf.seek(0);
raf.order(RandomAccessFile.BIG_ENDIAN);
int size = (int) wantSection.computeSize();
short[] arr = new short[size];
LayoutRegular indexer = new LayoutRegular(0, v2.getElementSize(), v2.getShape(), wantSection);
while (indexer.hasNext()) {
Layout.Chunk chunk = indexer.next();
raf.seek(chunk.getSrcPos());
raf.readShort(arr, (int) chunk.getDestElem(), chunk.getNelems()); // copy into primitive array
}
return Array.factory(v2.getDataType(), wantSection.getShape(), arr);
}
代码示例来源:origin: edu.ucar/netcdf
public Array readData(Variable v2, Section wantSection) throws IOException, InvalidRangeException {
// raf.seek(0);
raf.order(RandomAccessFile.BIG_ENDIAN);
int size = (int) wantSection.computeSize();
short[] arr = new short[size];
LayoutRegular indexer = new LayoutRegular(0, v2.getElementSize(), v2.getShape(), wantSection);
while (indexer.hasNext()) {
Layout.Chunk chunk = indexer.next();
raf.seek(chunk.getSrcPos());
raf.readShort(arr, (int) chunk.getDestElem(), chunk.getNelems()); // copy into primitive array
}
return Array.factory(v2.getDataType().getPrimitiveClassType(), wantSection.getShape(), arr);
}
代码示例来源:origin: edu.ucar/cdm
public Array readData(Variable v2, Section wantSection) throws IOException, InvalidRangeException {
// raf.seek(0);
raf.order(RandomAccessFile.BIG_ENDIAN);
int size = (int) wantSection.computeSize();
short[] arr = new short[size];
LayoutRegular indexer = new LayoutRegular(0, v2.getElementSize(), v2.getShape(), wantSection);
while (indexer.hasNext()) {
Layout.Chunk chunk = indexer.next();
raf.seek(chunk.getSrcPos());
raf.readShort(arr, (int) chunk.getDestElem(), chunk.getNelems()); // copy into primitive array
}
return Array.factory(v2.getDataType().getPrimitiveClassType(), wantSection.getShape(), arr);
}
内容来源于网络,如有侵权,请联系作者删除!