I'm using DataOutputStream
to write to a file, however I want to change the endian of the data.
This is how i'm writing the byte data to the file (it outputs in Little endian by default)
public void generateBinObjFile(String outputFile)
try {
// Create file
DataOutputStream stream = new DataOutputStream(
new FileOutputStream(outputFile));
stream.writeShort(this.quantize(this.xComponents.get(index), //<-- Short is written in little Endian
this.min_x, this.max_x) - 32768);
} // catch statements here
Is there a way i can define the Endian of how byte data is written in Java?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…