本文整理了Java中ucar.unidata.io.RandomAccessFile.skipBytes
方法的一些代码示例,展示了RandomAccessFile.skipBytes
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.skipBytes
方法的具体详情如下:
包路径:ucar.unidata.io.RandomAccessFile
类名称:RandomAccessFile
方法名:skipBytes
[英]Skips exactly n
bytes of input. This method blocks until all the bytes are skipped, the end of the stream is detected, or an exception is thrown.
[中]完全跳过n
字节的输入。此方法会一直阻塞,直到跳过所有字节、检测到流结束或引发异常为止。
代码示例来源:origin: edu.ucar/netcdf
private float getDataBlockValue1(RandomAccessFile raf, short offset, int skip) throws IOException {
long off = offset + message_offset + MESSAGE_HEADER_SIZE;
raf.seek(off);
raf.skipBytes(skip);
return raf.readFloat();
}
代码示例来源:origin: Unidata/thredds
private float getDataBlockValue1(RandomAccessFile raf, short offset, int skip) throws IOException {
long off = offset + message_offset + MESSAGE_HEADER_SIZE;
raf.seek(off);
raf.skipBytes(skip);
return raf.readFloat();
}
代码示例来源:origin: edu.ucar/netcdf
private short getDataBlockValue(RandomAccessFile raf, short offset, int skip) throws IOException {
long off = offset + message_offset + MESSAGE_HEADER_SIZE;
raf.seek(off);
raf.skipBytes(skip);
return raf.readShort();
}
代码示例来源:origin: edu.ucar/cdm
private short getDataBlockValue(RandomAccessFile raf, short offset, int skip) throws IOException {
long off = offset + message_offset + MESSAGE_HEADER_SIZE;
raf.seek(off);
raf.skipBytes(skip);
return raf.readShort();
}
代码示例来源:origin: edu.ucar/cdm
void read() throws IOException {
version = raf.readByte();
raf.skipBytes(3); // skip byte
secs = raf.readInt();
}
代码示例来源:origin: edu.ucar/netcdf
void read() throws IOException {
byte version = raf.readByte();
byte nfilters = raf.readByte();
if (version == 1) raf.skipBytes(6);
filters = new Filter[nfilters];
for (int i = 0; i < nfilters; i++)
filters[i] = new Filter(version);
if (debug1) debugOut.println(" MessageFilter version=" + version + this);
}
代码示例来源:origin: edu.ucar/cdm
void read() throws IOException {
byte version = raf.readByte();
byte nfilters = raf.readByte();
if (version == 1) raf.skipBytes(6);
filters = new Filter[nfilters];
for (int i = 0; i < nfilters; i++)
filters[i] = new Filter(version);
if (debug1) debugOut.println(" MessageFilter version=" + version + this);
}
代码示例来源:origin: edu.ucar/grib
static public boolean isValidFile(RandomAccessFile raf) throws IOException {
raf.seek(0);
if (!raf.searchForward(matcher, 8000)) return false; // must find "GRIB" in first 8k
raf.skipBytes(4);
// Read Section 0 Indicator Section to get Edition number
Grib2IndicatorSection is = new Grib2IndicatorSection(raf); // section 0
if (is.getGribEdition() != 1 && is.getGribEdition() != 2)
return false;
if (is.getGribLength() > raf.length())
return false;
return true;
}
代码示例来源:origin: edu.ucar/netcdf
Object readDoubleArray1D(int offsetInRecord) throws IOException {
int elementSizeInBytes = 8;
double[] array = new double[header.getNumDataRecords()];
this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
for (int i = 0; i < header.getNumDataRecords(); i++) {
this.raf.readDouble(array, i, 1);
this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
}
return (array);
}
代码示例来源:origin: edu.ucar/cdm
Object readFloatArray1D(int offsetInRecord) throws IOException {
int elementSizeInBytes = 4;
float[] array = new float[header.getNumDataRecords()];
this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
for (int i = 0; i < header.getNumDataRecords(); i++) {
this.raf.readFloat(array, i, 1);
this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
}
return (array);
}
代码示例来源:origin: Unidata/thredds
Object readFloatArray1D(int offsetInRecord) throws IOException {
int elementSizeInBytes = 4;
float[] array = new float[header.getNumDataRecords()];
this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
for (int i = 0; i < header.getNumDataRecords(); i++) {
this.raf.readFloat(array, i, 1);
this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
}
return (array);
}
代码示例来源:origin: edu.ucar/netcdf
Object readFloatArray1D(int offsetInRecord) throws IOException {
int elementSizeInBytes = 4;
float[] array = new float[header.getNumDataRecords()];
this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
for (int i = 0; i < header.getNumDataRecords(); i++) {
this.raf.readFloat(array, i, 1);
this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
}
return (array);
}
代码示例来源:origin: Unidata/thredds
Object readIntArray1D(int offsetInRecord) throws IOException {
int elementSizeInBytes = 4;
int[] array = new int[header.getNumDataRecords()];
this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
for (int i = 0; i < header.getNumDataRecords(); i++) {
this.raf.readInt(array, i, 1);
this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
}
return (array);
}
代码示例来源:origin: Unidata/thredds
Object readDoubleArray1D(int offsetInRecord) throws IOException {
int elementSizeInBytes = 8;
double[] array = new double[header.getNumDataRecords()];
this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
for (int i = 0; i < header.getNumDataRecords(); i++) {
this.raf.readDouble(array, i, 1);
this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
}
return (array);
}
代码示例来源:origin: Unidata/thredds
Object readByteArray2D(int offsetInRecord, int numElementsInRecord) throws IOException {
byte[] array = new byte[header.getNumDataRecords() * numElementsInRecord];
this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
for (int i = 0; i < header.getNumDataRecords(); i++) {
this.raf.readFully(array, i * numElementsInRecord, numElementsInRecord);
this.raf.skipBytes(header.getRecordSizeInBytes() - numElementsInRecord);
}
return (array);
}
代码示例来源:origin: edu.ucar/netcdf
Object readByteArray2D(int offsetInRecord, int numElementsInRecord) throws IOException {
byte[] array = new byte[header.getNumDataRecords() * numElementsInRecord];
this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
for (int i = 0; i < header.getNumDataRecords(); i++) {
this.raf.read(array, i * numElementsInRecord, numElementsInRecord);
this.raf.skipBytes(header.getRecordSizeInBytes() - numElementsInRecord);
}
return (array);
}
代码示例来源:origin: edu.ucar/cdm
Object readIntArray1D(int offsetInRecord) throws IOException {
int elementSizeInBytes = 4;
int[] array = new int[header.getNumDataRecords()];
this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord);
for (int i = 0; i < header.getNumDataRecords(); i++) {
this.raf.readInt(array, i, 1);
this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes);
}
return (array);
}
代码示例来源: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();
}
内容来源于网络,如有侵权,请联系作者删除!