Skip to content

Commit

Permalink
publish 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkhala committed Apr 24, 2024
1 parent 944197b commit 66b5ad8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/davidkhala/common/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ public class Stream {
public static String read(InputStream is) throws IOException {
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
while (true) {
if (is.read(buffer) < 0) {
break;
}
}

is.close();
return new String(buffer);
}
public static InputStream from(String string) throws IOException {

public static InputStream from(String string) {
return new ByteArrayInputStream(string.getBytes());
}
}

0 comments on commit 66b5ad8

Please sign in to comment.