public class EnhancedDataOutputStream extends DataOutputStream {
- public EnhancedDataOutputStream(final OutputStream out) {
- super(out);
- }
+ public EnhancedDataOutputStream(final OutputStream out) {
+ super(out);
+ }
- public void writeIntegerList(final List<Integer> list) throws IOException {
- writeInt(list.size());
+ public void writeIntegerList(final List<Integer> list) throws IOException {
+ writeInt(list.size());
- for (final Integer integer : list)
- writeInt(integer);
- }
+ for (final Integer integer : list)
+ writeInt(integer);
+ }
- public void writeString(final String string) throws IOException {
- if (string == null) {
- writeInt(-1);
- return;
- }
+ public void writeString(final String string) throws IOException {
+ if (string == null) {
+ writeInt(-1);
+ return;
+ }
- final byte[] bytes = string.getBytes("UTF-8");
+ final byte[] bytes = string.getBytes("UTF-8");
- writeInt(bytes.length);
- write(bytes);
- }
+ writeInt(bytes.length);
+ write(bytes);
+ }
}