Skip to content

Commit c627250

Browse files
committed
default byte orders, byte order constructors
1 parent a851d02 commit c627250

2 files changed

Lines changed: 42 additions & 5 deletions

File tree

src/main/java/mil/nga/sf/util/ByteReader.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ public class ByteReader {
2121
private static final Logger logger = Logger
2222
.getLogger(ByteReader.class.getName());
2323

24+
/**
25+
* Default read byte order
26+
*
27+
* @since 2.0.3
28+
*/
29+
public static final ByteOrder DEFAULT_BYTE_ORDER = ByteOrder.BIG_ENDIAN;
30+
2431
/**
2532
* Character set
2633
*/
@@ -44,7 +51,7 @@ public class ByteReader {
4451
/**
4552
* Byte order
4653
*/
47-
private ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
54+
private ByteOrder byteOrder = DEFAULT_BYTE_ORDER;
4855

4956
/**
5057
* Constructor

src/main/java/mil/nga/sf/util/ByteWriter.java

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ public class ByteWriter {
2121
private static final Logger logger = Logger
2222
.getLogger(ByteWriter.class.getName());
2323

24+
/**
25+
* Default write byte order
26+
*
27+
* @since 2.0.3
28+
*/
29+
public static final ByteOrder DEFAULT_BYTE_ORDER = ByteOrder.BIG_ENDIAN;
30+
2431
/**
2532
* Output stream to write bytes to
2633
*/
@@ -29,7 +36,7 @@ public class ByteWriter {
2936
/**
3037
* Byte order
3138
*/
32-
private ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
39+
private ByteOrder byteOrder = DEFAULT_BYTE_ORDER;
3340

3441
/**
3542
* Constructor
@@ -43,18 +50,42 @@ public ByteWriter() {
4350
*
4451
* @param outputStream
4552
* output stream
46-
*
4753
* @since 2.0.3
4854
*/
4955
public ByteWriter(OutputStream outputStream) {
5056
this.outputStream = outputStream;
5157
}
5258

59+
/**
60+
* Constructor
61+
*
62+
* @param byteOrder
63+
* byte order
64+
* @since 2.0.3
65+
*/
66+
public ByteWriter(ByteOrder byteOrder) {
67+
this();
68+
this.byteOrder = byteOrder;
69+
}
70+
71+
/**
72+
* Constructor
73+
*
74+
* @param outputStream
75+
* output stream
76+
* @param byteOrder
77+
* byte order
78+
* @since 2.0.3
79+
*/
80+
public ByteWriter(OutputStream outputStream, ByteOrder byteOrder) {
81+
this(outputStream);
82+
this.byteOrder = byteOrder;
83+
}
84+
5385
/**
5486
* Get the output stream
5587
*
5688
* @return output stream
57-
*
5889
* @since 2.0.3
5990
*/
6091
public OutputStream getOutputStream() {
@@ -65,7 +96,6 @@ public OutputStream getOutputStream() {
6596
* Get the output stream
6697
*
6798
* @return output stream
68-
*
6999
* @since 2.0.3
70100
*/
71101
public ByteArrayOutputStream getByteArrayOutputStream() {

0 commit comments

Comments
 (0)