/** * Reads a single-precision floating point value (32bit, 4 bytes) from the given position, in big endian * byte order. This method's speed depends on the system's native byte order, and it * is possibly slower than {@link #getFloat(int)}. For most cases (such as * transient storage in memory or serialization for I/O and network), * it suffices to know that the byte order in which the value is written is the same as the * one in which it is read, and {@link #getFloat(int)} is the preferable choice. * * @param index The position from which the value will be read. * @return The long value at the given position. * * @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger then the segment * size minus 8. */ public final float getFloatBigEndian(int index) { return Float.intBitsToFloat(getIntBigEndian(index)); }
int r = segment.getIntBigEndian(pos); assertEquals(val, Integer.reverseBytes(r));
assertEquals(992288337, seg.getIntBigEndian(187));
@Override public final int readInt() throws IOException { final int v = this.segment.getIntBigEndian(this.position); this.position += 4; return v; }
@Override public final int readInt() throws IOException { final int v = this.segment.getIntBigEndian(this.position); this.position += 4; return v; }
@Override public final int readInt() throws IOException { final int v = this.segment.getIntBigEndian(this.position); this.position += 4; return v; }
@Override public final int readInt() throws IOException { final int v = this.segment.getIntBigEndian(this.position); this.position += 4; return v; }
@Override protected int _getInt(int index) { return memorySegment.getIntBigEndian(index); }
@Override public final int readInt() throws IOException { final int v = this.segment.getIntBigEndian(this.position); this.position += 4; return v; }
@Override protected int _getInt(int index) { return memorySegment.getIntBigEndian(index); }
@Override protected int _getInt(int index) { return memorySegment.getIntBigEndian(index); }
/** * Reads a single-precision floating point value (32bit, 4 bytes) from the given position, in big endian * byte order. This method's speed depends on the system's native byte order, and it * is possibly slower than {@link #getFloat(int)}. For most cases (such as * transient storage in memory or serialization for I/O and network), * it suffices to know that the byte order in which the value is written is the same as the * one in which it is read, and {@link #getFloat(int)} is the preferable choice. * * @param index The position from which the value will be read. * @return The long value at the given position. * * @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger then the segment * size minus 8. */ public final float getFloatBigEndian(int index) { return Float.intBitsToFloat(getIntBigEndian(index)); }
/** * Reads a single-precision floating point value (32bit, 4 bytes) from the given position, in big endian * byte order. This method's speed depends on the system's native byte order, and it * is possibly slower than {@link #getFloat(int)}. For most cases (such as * transient storage in memory or serialization for I/O and network), * it suffices to know that the byte order in which the value is written is the same as the * one in which it is read, and {@link #getFloat(int)} is the preferable choice. * * @param index The position from which the value will be read. * @return The long value at the given position. * * @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger then the segment * size minus 8. */ public final float getFloatBigEndian(int index) { return Float.intBitsToFloat(getIntBigEndian(index)); }
@Override public int readInt() throws IOException { if (this.positionInSegment < this.limitInSegment - 3) { final int v = this.currentSegment.getIntBigEndian(this.positionInSegment); this.positionInSegment += 4; return v; } else if (this.positionInSegment == this.limitInSegment) { advance(); return readInt(); } else { return (readUnsignedByte() << 24) | (readUnsignedByte() << 16) | (readUnsignedByte() << 8) | readUnsignedByte(); } }
@Override public int readInt() throws IOException { if (this.positionInSegment < this.limitInSegment - 3) { final int v = this.currentSegment.getIntBigEndian(this.positionInSegment); this.positionInSegment += 4; return v; } else if (this.positionInSegment == this.limitInSegment) { advance(); return readInt(); } else { return (readUnsignedByte() << 24) | (readUnsignedByte() << 16) | (readUnsignedByte() << 8) | readUnsignedByte(); } }
@Override public int readInt() throws IOException { if (this.positionInSegment < this.limitInSegment - 3) { final int v = this.currentSegment.getIntBigEndian(this.positionInSegment); this.positionInSegment += 4; return v; } else if (this.positionInSegment == this.limitInSegment) { advance(); return readInt(); } else { return (readUnsignedByte() << 24) | (readUnsignedByte() << 16) | (readUnsignedByte() << 8) | readUnsignedByte(); } }
@Override public int readInt() throws IOException { if (this.positionInSegment < this.limitInSegment - 3) { final int v = this.currentSegment.getIntBigEndian(this.positionInSegment); this.positionInSegment += 4; return v; } else if (this.positionInSegment == this.limitInSegment) { advance(); return readInt(); } else { return (readUnsignedByte() << 24) | (readUnsignedByte() << 16) | (readUnsignedByte() << 8) | readUnsignedByte(); } }