Skip to content

Commit

Permalink
Release 1.0.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
khituras committed Aug 6, 2018
1 parent b779934 commit d4583ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>julielab-java-utilities</artifactId>
<packaging>jar</packaging>
<version>1.0.3-SNAPSHOT</version>
<version>1.0.3</version>
<name>julielab-java-utilities</name>
<url>http://maven.apache.org</url>
<dependencies>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/de/julielab/java/utilities/IOStreamUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@
import java.util.stream.Stream;

public class IOStreamUtilities {
/**
* Returns a buffered reader with UTF-8 encoding from the given input stream.
* @param is The input stream to get an UTF-8 reader from.
* @return A UTF-8 encoding reader.
*/
public static BufferedReader getReaderFromInputStream(InputStream is) {
return new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
}

/**
* Interprets <tt>is</tt> as a stream of UTF-8 encoded lines and returns all lines.
* @param is The input stream.
* @return All UTF-8 encoded lines from the input stream.
* @throws IOException If reading fails.
*/
public static List<String> getLinesFromInputStream(InputStream is) throws IOException {
try (BufferedReader br = getReaderFromInputStream(is)) {
return br.lines().collect(Collectors.toList());
Expand Down

0 comments on commit d4583ef

Please sign in to comment.