2 * Svjatoslav Commons - shared library of common functionality.
3 * Copyright ©2012-2017, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 3 of the GNU Lesser General Public License
7 * or later as published by the Free Software Foundation.
10 package eu.svjatoslav.commons.data;
12 import java.io.DataInputStream;
13 import java.io.IOException;
14 import java.io.InputStream;
15 import java.util.ArrayList;
16 import java.util.List;
18 public class EnhancedDataInputStream extends DataInputStream {
20 public EnhancedDataInputStream(final InputStream in) {
24 public List<Integer> readIntegerList() throws IOException {
25 final int length = readInt();
27 final List<Integer> result = new ArrayList<>();
29 for (int i = 0; i < length; i++)
30 result.add(readInt());
35 public String readString() throws IOException {
37 final int length = readInt();
41 final byte[] bytes = new byte[length];
44 return new String(bytes, "UTF-8");