Skip to content

Commit

Permalink
Fix output flushing
Browse files Browse the repository at this point in the history
  • Loading branch information
basilevs committed Mar 28, 2023
1 parent da5ac76 commit 52388de
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions library/src/main/java/org/basilevs/jstackfilter/Filter.java
Expand Up @@ -47,10 +47,18 @@ public void close() throws IOException {


public static void copy(Reader input, Writer output) throws IOException {
char[] buffer = new char[1024 * 1024];
int n = 0;
while (-1 != (n = input.read(buffer))) {
output.write(buffer, 0, n);
try {
char[] buffer = new char[1024 * 1024];
int n = 0;
while (-1 != (n = input.read(buffer))) {
output.write(buffer, 0, n);
}
} finally {
try {
input.close();
} finally {
output.close();
}
}
}

Expand Down

0 comments on commit 52388de

Please sign in to comment.