/** * Reads the next float from the given DataInputStream, where the data is in little endian. * * @param dataStream * the DataInputStream to read from * @throws IOException * IOException * @return a float */ public static float readLittleEndianFloat(DataInputStream dataStream) throws IOException { return Float.intBitsToFloat(readLittleEndianInt(dataStream)); }
/** * Reads the next float from the given DataInputStream, where the data is in little endian. * * @param dataStream * the DataInputStream to read from * @throws IOException * IOException * @return a float */ public static float readLittleEndianFloat(DataInputStream dataStream) throws IOException { return Float.intBitsToFloat(readLittleEndianInt(dataStream)); }
/** * Read an integer from the input stream, byte-swapping as necessary * * @param dis * the inputstream * @param isBigEndian * whether or not the data being read in is in big endian format. * * @return an integer value * * @throws IOException * on error */ public static int readInt(DataInputStream dis, boolean isBigEndian) throws IOException { if (!isBigEndian) { return readLittleEndianInt(dis); } else { return dis.readInt(); } }
/** * Read an integer from the input stream, byte-swapping as necessary * * @param dis * the inputstream * @param isBigEndian * whether or not the data being read in is in big endian format. * * @return an integer value * * @throws IOException * on error */ public static int readInt(DataInputStream dis, boolean isBigEndian) throws IOException { if (!isBigEndian) { return readLittleEndianInt(dis); } else { return dis.readInt(); } }