/** * Get a NE long value from an InputStream * * @param stream the InputStream from which the long is to be read * @return the long (64-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readLongBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); int ch5 = stream.read(); int ch6 = stream.read(); int ch7 = stream.read(); int ch8 = stream.read(); if ((ch1 | ch2 | ch3 | ch4 | ch5 | ch6 | ch7 | ch8) < 0) { throw new BufferUnderrunException(); } return ((long) ch1 << 56) + ((long) ch2 << 48) + ((long) ch3 << 40) + ((long) ch4 << 32) + ((long) ch5 << 24) + // cast to long to preserve bit 31 (sign bit for ints) (ch6 << 16) + (ch7 << 8) + (ch8 << 0); }
/** * Get a NE long value from an InputStream * * @param stream the InputStream from which the long is to be read * @return the long (64-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readLongBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); int ch5 = stream.read(); int ch6 = stream.read(); int ch7 = stream.read(); int ch8 = stream.read(); if ((ch1 | ch2 | ch3 | ch4 | ch5 | ch6 | ch7 | ch8) < 0) { throw new BufferUnderrunException(); } return ((long) ch1 << 56) + ((long) ch2 << 48) + ((long) ch3 << 40) + ((long) ch4 << 32) + ((long) ch5 << 24) + // cast to long to preserve bit 31 (sign bit for ints) (ch6 << 16) + (ch7 << 8) + (ch8 << 0); }
/** * Get a LE long value from an InputStream * * @param stream the InputStream from which the long is to be read * @return the long (64-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readLongLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); int ch5 = stream.read(); int ch6 = stream.read(); int ch7 = stream.read(); int ch8 = stream.read(); if ((ch1 | ch2 | ch3 | ch4 | ch5 | ch6 | ch7 | ch8) < 0) { throw new BufferUnderrunException(); } return ((long) ch8 << 56) + ((long) ch7 << 48) + ((long) ch6 << 40) + ((long) ch5 << 32) + ((long) ch4 << 24) + // cast to long to preserve bit 31 (sign bit for ints) (ch3 << 16) + (ch2 << 8) + (ch1 << 0); }
/** * Get a LE long value from an InputStream * * @param stream the InputStream from which the long is to be read * @return the long (64-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readLongLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); int ch5 = stream.read(); int ch6 = stream.read(); int ch7 = stream.read(); int ch8 = stream.read(); if ((ch1 | ch2 | ch3 | ch4 | ch5 | ch6 | ch7 | ch8) < 0) { throw new BufferUnderrunException(); } return ((long) ch8 << 56) + ((long) ch7 << 48) + ((long) ch6 << 40) + ((long) ch5 << 32) + ((long) ch4 << 24) + // cast to long to preserve bit 31 (sign bit for ints) (ch3 << 16) + (ch2 << 8) + (ch1 << 0); }
/** * Get a NE long value from an InputStream * * @param stream the InputStream from which the long is to be read * @return the long (64-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readLongBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); int ch5 = stream.read(); int ch6 = stream.read(); int ch7 = stream.read(); int ch8 = stream.read(); if ((ch1 | ch2 | ch3 | ch4 | ch5 | ch6 | ch7 | ch8) < 0) { throw new BufferUnderrunException(); } return ((long) ch1 << 56) + ((long) ch2 << 48) + ((long) ch3 << 40) + ((long) ch4 << 32) + ((long) ch5 << 24) + // cast to long to preserve bit 31 (sign bit for ints) (ch6 << 16) + (ch7 << 8) + (ch8 << 0); }
/** * Get a BE unsigned int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readUIntBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)) & 0x00FFFFFFFFl; } /**
/** * Get a LE int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static int readIntLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return (ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0); }
/** * Get a LE unsigned int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readUIntLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)) & 0x00FFFFFFFFl; }
/** * Get a BE int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static int readIntBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return (ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0); }
/** * Get a LE int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static int readIntLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return (ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0); }
/** * Get a LE unsigned int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readUIntLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)) & 0x00FFFFFFFFl; }
/** * Get a BE unsigned int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readUIntBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)) & 0x00FFFFFFFFl; } /**
/** * Get a BE int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static int readIntBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return (ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0); }
public static int readUShortLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); if ((ch1 | ch2) < 0) { throw new BufferUnderrunException(); } return (ch2 << 8) + (ch1 << 0); }
public static int readUShortBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); if ((ch1 | ch2) < 0) { throw new BufferUnderrunException(); } return (ch1 << 8) + (ch2 << 0); }
public static int readUShortBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); if ((ch1 | ch2) < 0) { throw new BufferUnderrunException(); } return (ch1 << 8) + (ch2 << 0); }
public static int readUShortLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); if ((ch1 | ch2) < 0) { throw new BufferUnderrunException(); } return (ch2 << 8) + (ch1 << 0); }
/** * Get a LE long value from an InputStream * * @param stream the InputStream from which the long is to be read * @return the long (64-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readLongLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); int ch5 = stream.read(); int ch6 = stream.read(); int ch7 = stream.read(); int ch8 = stream.read(); if ((ch1 | ch2 | ch3 | ch4 | ch5 | ch6 | ch7 | ch8) < 0) { throw new BufferUnderrunException(); } return ((long) ch8 << 56) + ((long) ch7 << 48) + ((long) ch6 << 40) + ((long) ch5 << 32) + ((long) ch4 << 24) + // cast to long to preserve bit 31 (sign bit for ints) (ch3 << 16) + (ch2 << 8) + (ch1 << 0); }
/** * Get a BE unsigned int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readUIntBE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)) & 0x00FFFFFFFFl; } /**
/** * Get a LE unsigned int value from an InputStream * * @param stream the InputStream from which the int is to be read * @return the int (32-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static long readUIntLE(InputStream stream) throws IOException, BufferUnderrunException { int ch1 = stream.read(); int ch2 = stream.read(); int ch3 = stream.read(); int ch4 = stream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new BufferUnderrunException(); } return ((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0)) & 0x00FFFFFFFFl; }