2 * Svjatoslav Commons - shared library of common functionality. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
5 package eu.svjatoslav.commons.data;
7 import java.io.DataInputStream;
8 import java.io.IOException;
9 import java.io.InputStream;
10 import java.util.ArrayList;
11 import java.util.List;
13 public class EnhancedDataInputStream extends DataInputStream {
15 public EnhancedDataInputStream(final InputStream in) {
19 public List<Integer> readIntegerList() throws IOException {
20 final int length = readInt();
22 final List<Integer> result = new ArrayList<>();
24 for (int i = 0; i < length; i++)
25 result.add(readInt());
30 public String readString() throws IOException {
32 final int length = readInt();
36 final byte[] bytes = new byte[length];
39 return new String(bytes, "UTF-8");