X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fcommons%2Fdata%2FEnhancedDataInputStream.java;h=45fcaf5bde9b7150267632be06b293c93c2662db;hb=9bf004ce4e9b5edff36c65fcc8cc0f303390d7fc;hp=e093619a04b2fc7313ad9b451079e8061063b212;hpb=cf965fda534cc562368c9f2a3f34475e2519fcdc;p=svjatoslav_commons.git diff --git a/src/main/java/eu/svjatoslav/commons/data/EnhancedDataInputStream.java b/src/main/java/eu/svjatoslav/commons/data/EnhancedDataInputStream.java old mode 100644 new mode 100755 index e093619..45fcaf5 --- a/src/main/java/eu/svjatoslav/commons/data/EnhancedDataInputStream.java +++ b/src/main/java/eu/svjatoslav/commons/data/EnhancedDataInputStream.java @@ -1,10 +1,10 @@ /* * Svjatoslav Commons - shared library of common functionality. - * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Copyright ©2012-2014, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. + * modify it under the terms of version 3 of the GNU Lesser General Public License + * or later as published by the Free Software Foundation. */ package eu.svjatoslav.commons.data; @@ -17,31 +17,31 @@ import java.util.List; public class EnhancedDataInputStream extends DataInputStream { - public EnhancedDataInputStream(final InputStream in) { - super(in); - } + public EnhancedDataInputStream(final InputStream in) { + super(in); + } - public List readIntegerList() throws IOException { - final int length = readInt(); + public List readIntegerList() throws IOException { + final int length = readInt(); - final List result = new ArrayList(); + final List result = new ArrayList<>(); - for (int i = 0; i < length; i++) - result.add(readInt()); + for (int i = 0; i < length; i++) + result.add(readInt()); - return result; - } + return result; + } - public String readString() throws IOException { + public String readString() throws IOException { - final int length = readInt(); - if (length == -1) - return null; + final int length = readInt(); + if (length == -1) + return null; - final byte[] bytes = new byte[length]; - readFully(bytes); + final byte[] bytes = new byte[length]; + readFully(bytes); - return new String(bytes); - } + return new String(bytes, "UTF-8"); + } }