Fix exceptions for readers, add path writer.
This commit is contained in:
30
src/main/org/insa/graph/io/BinaryWriter.java
Normal file
30
src/main/org/insa/graph/io/BinaryWriter.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package org.insa.graph.io;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class BinaryWriter {
|
||||
|
||||
// Output stream.
|
||||
protected DataOutputStream dos;
|
||||
|
||||
/**
|
||||
* @param dos
|
||||
*/
|
||||
protected BinaryWriter(DataOutputStream dos) {
|
||||
this.dos = dos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a 24-bits integer in BigEndian to the output stream.
|
||||
*
|
||||
* @param value
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
protected void write24bits(int value) throws IOException {
|
||||
dos.writeShort(value >> 8);
|
||||
dos.writeByte(value & 0xff);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user