/** * Writes a float to the given DataOutputStream, where the data is in little endian. * * @param dataStream * the DataOutputStream to write to. * @param val * The float value to write. * @throws IOException * IOException */ public static void writeLittleEndianFloat(DataOutputStream dataStream, float val) throws IOException { writeLittleEndianInt(dataStream, Float.floatToRawIntBits(val)); }
/** * Writes a float to the given DataOutputStream, where the data is in little endian. * * @param dataStream * the DataOutputStream to write to. * @param val * The float value to write. * @throws IOException * IOException */ public static void writeLittleEndianFloat(DataOutputStream dataStream, float val) throws IOException { writeLittleEndianInt(dataStream, Float.floatToRawIntBits(val)); }
/** * Writes an integer to the output stream, byte-swapping as necessary * * @param dis * the outputstream. * @param isBigEndian * whether or not the data being read in is in big endian format. * @param val * the integer value to write. * * @throws IOException * on error */ public static void writeInt(DataOutputStream dis, boolean isBigEndian, int val) throws IOException { if (!isBigEndian) { writeLittleEndianInt(dis, val); } else { dis.writeInt(val); } }
/** * Writes an integer to the output stream, byte-swapping as necessary * * @param dis * the outputstream. * @param isBigEndian * whether or not the data being read in is in big endian format. * @param val * the integer value to write. * * @throws IOException * on error */ public static void writeInt(DataOutputStream dis, boolean isBigEndian, int val) throws IOException { if (!isBigEndian) { writeLittleEndianInt(dis, val); } else { dis.writeInt(val); } }