本文整理了Java中ucar.unidata.io.RandomAccessFile.readLong
方法的一些代码示例,展示了RandomAccessFile.readLong
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.readLong
方法的具体详情如下:
包路径:ucar.unidata.io.RandomAccessFile
类名称:RandomAccessFile
方法名:readLong
[英]Reads a signed 64-bit integer from this file. This method reads eight bytes from the file. If the bytes read, in order, are b1
, b2
, b3
, b4
, b5
, b6
, b7
, and b8,
where:
0 <= b1, b2, b3, b4, b5, b6, b7, b8 <=255,
then the result is equal to:
((long)b1 << 56) + ((long)b2 << 48)
+ ((long)b3 << 40) + ((long)b4 << 32)
+ ((long)b5 << 24) + ((long)b6 << 16)
+ ((long)b7 << 8) + b8
This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.
[中]从该文件中读取带符号的64位整数。此方法从文件中读取八个字节。如果按顺序读取的字节为b1
、b2
、b3
、b4
、b5
、b6
、b7
和b8,
,其中:0 <= b1, b2, b3, b4, b5, b6, b7, b8 <=255,
那么结果等于:
((long)b1 << 56) + ((long)b2 << 48)
+ ((long)b3 << 40) + ((long)b4 << 32)
+ ((long)b5 << 24) + ((long)b6 << 16)
+ ((long)b7 << 8) + b8
此方法会一直阻塞,直到读取了八个字节、检测到流结束或引发异常为止。
代码示例来源:origin: edu.ucar/netcdf
/**
* Read an array of longs
*
* @param pa read into this array
* @param start starting at pa[start]
* @param n read this many elements
* @throws IOException on read error
*/
public final void readLong(long[] pa, int start, int n) throws IOException {
for (int i = 0; i < n; i++) {
pa[start + i] = readLong();
}
}
代码示例来源:origin: edu.ucar/cdm
/**
* Read an array of longs
*
* @param pa read into this array
* @param start starting at pa[start]
* @param n read this many elements
* @throws IOException on read error
*/
public final void readLong(long[] pa, int start, int n) throws IOException {
for (int i = 0; i < n; i++) {
pa[start + i] = readLong();
}
}
代码示例来源:origin: Unidata/thredds
/**
* Read an array of longs
*
* @param pa read into this array
* @param start starting at pa[start]
* @param n read this many elements
* @throws IOException on read error
*/
public final void readLong(long[] pa, int start, int n) throws IOException {
for (int i = 0; i < n; i++) {
pa[start + i] = readLong();
}
}
代码示例来源:origin: edu.ucar/unidataCommon
/**
* Read an array of longs
*
* @param pa read into this array
* @param start starting at pa[start]
* @param n read this many elements
* @throws IOException on read error
*/
public final void readLong(long[] pa, int start, int n) throws IOException {
for (int i = 0; i < n; i++) {
pa[start + i] = readLong();
}
}
代码示例来源:origin: edu.ucar/cdm
/**
* Read an array of doubles
*
* @param pa read into this array
* @param start starting at pa[start]
* @param n read this many elements
* @throws IOException on read error
*/
public final void readDouble(double[] pa, int start, int n) throws IOException {
for (int i = 0; i < n; i++) {
pa[start + i] = Double.longBitsToDouble(readLong());
}
}
代码示例来源:origin: Unidata/thredds
/**
* Read an array of doubles
*
* @param pa read into this array
* @param start starting at pa[start]
* @param n read this many elements
* @throws IOException on read error
*/
public final void readDouble(double[] pa, int start, int n) throws IOException {
for (int i = 0; i < n; i++) {
pa[start + i] = Double.longBitsToDouble(readLong());
}
}
代码示例来源:origin: edu.ucar/unidataCommon
/**
* Read an array of doubles
*
* @param pa read into this array
* @param start starting at pa[start]
* @param n read this many elements
* @throws IOException on read error
*/
public final void readDouble(double[] pa, int start, int n) throws IOException {
for (int i = 0; i < n; i++) {
pa[start + i] = Double.longBitsToDouble(readLong());
}
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Read an array of doubles
*
* @param pa read into this array
* @param start starting at pa[start]
* @param n read this many elements
* @throws IOException on read error
*/
public final void readDouble(double[] pa, int start, int n) throws IOException {
for (int i = 0; i < n; i++) {
pa[start + i] = Double.longBitsToDouble(readLong());
}
}
代码示例来源:origin: edu.ucar/netcdf
long readLength() throws IOException {
return isLengthLong ? raf.readLong() : (long) raf.readInt();
}
代码示例来源:origin: edu.ucar/cdm
long readLength() throws IOException {
return isLengthLong ? raf.readLong() : (long) raf.readInt();
}
代码示例来源:origin: edu.ucar/cdm
long readOffset() throws IOException {
return isOffsetLong ? raf.readLong() : (long) raf.readInt();
}
代码示例来源:origin: Unidata/thredds
long readLength() throws IOException {
return isLengthLong ? raf.readLong() : (long) raf.readInt();
}
代码示例来源:origin: Unidata/thredds
Record6() throws IOException {
creationOrder = raf.readLong();
raf.readFully(heapId);
if (debugBtree2)
debugOut.println(" record6 creationOrder=" + creationOrder + " heapId=" + Misc.showBytes(heapId));
}
}
代码示例来源:origin: edu.ucar/netcdf
Record6() throws IOException {
creationOrder = raf.readLong();
raf.read(heapId);
if (debugBtree2)
debugOut.println(" record6 creationOrder=" + creationOrder + " heapId=" + Misc.showBytes(heapId));
}
}
代码示例来源:origin: edu.ucar/cdm
Record6() throws IOException {
creationOrder = raf.readLong();
raf.readFully(heapId);
if (debugBtree2)
debugOut.println(" record6 creationOrder=" + creationOrder + " heapId=" + Misc.showBytes(heapId));
}
}
代码示例来源:origin: edu.ucar/cdm
void read() throws IOException {
if (debugPos) debugOut.println(" *MessageGroupNew start pos= " + raf.getFilePointer());
byte version = raf.readByte();
byte flags = raf.readByte();
if ((flags & 1) != 0) {
maxCreationIndex = raf.readLong();
}
fractalHeapAddress = readOffset();
v2BtreeAddress = readOffset(); // aka name index
if ((flags & 2) != 0) {
v2BtreeAddressCreationOrder = readOffset();
}
if (debug1) debugOut.println(" MessageGroupNew version= " + version + " flags = " + flags + this);
}
代码示例来源:origin: edu.ucar/netcdf
void read() throws IOException {
if (debugPos) debugOut.println(" *MessageGroupNew start pos= " + raf.getFilePointer());
byte version = raf.readByte();
byte flags = raf.readByte();
if ((flags & 1) != 0) {
maxCreationIndex = raf.readLong();
}
fractalHeapAddress = readOffset();
v2BtreeAddress = readOffset(); // aka name index
if ((flags & 2) != 0) {
v2BtreeAddressCreationOrder = readOffset();
}
if (debug1) debugOut.println(" MessageGroupNew version= " + version + " flags = " + flags + this);
}
代码示例来源:origin: Unidata/thredds
DataChunk(int ndim, boolean last) throws IOException {
this.size = h5.raf.readInt();
this.filterMask = h5.raf.readInt();
offset = new int[ndim];
for (int i = 0; i < ndim; i++) {
long loffset = h5.raf.readLong();
assert loffset < Integer.MAX_VALUE;
offset[i] = (int) loffset;
}
this.filePos = last ? -1 : h5.readAddress(); //
if (memTracker != null) memTracker.addByLen("Chunked Data (" + owner + ")", filePos, size);
}
代码示例来源:origin: edu.ucar/netcdf
DataChunk(int ndim, boolean last) throws IOException {
this.size = raf.readInt();
this.filterMask = raf.readInt();
offset = new int[ndim];
for (int i = 0; i < ndim; i++) {
long loffset = raf.readLong();
assert loffset < Integer.MAX_VALUE;
offset[i] = (int) loffset;
}
this.filePos = last ? -1 : h5.readAddress(); //
if (memTracker != null) memTracker.addByLen("Chunked Data (" + owner + ")", filePos, size);
}
代码示例来源:origin: edu.ucar/cdm
DataChunk(int ndim, boolean last) throws IOException {
this.size = raf.readInt();
this.filterMask = raf.readInt();
offset = new int[ndim];
for (int i = 0; i < ndim; i++) {
long loffset = raf.readLong();
assert loffset < Integer.MAX_VALUE;
offset[i] = (int) loffset;
}
this.filePos = last ? -1 : h5.readAddress(); //
if (memTracker != null) memTracker.addByLen("Chunked Data (" + owner + ")", filePos, size);
}
内容来源于网络,如有侵权,请联系作者删除!