diff --git a/src/main/java/fi/solita/clamav/ClamAVClient.java b/src/main/java/fi/solita/clamav/ClamAVClient.java index 7f14e11..e76f11f 100644 --- a/src/main/java/fi/solita/clamav/ClamAVClient.java +++ b/src/main/java/fi/solita/clamav/ClamAVClient.java @@ -154,10 +154,9 @@ private static byte[] readAll(InputStream is) throws IOException { byte[] buf = new byte[2000]; int read = 0; - do { - read = is.read(buf); - tmp.write(buf, 0, read); - } while ((read > 0) && (is.available() > 0)); + while ((read = is.read(buf)) != -1) { + tmp.write(buf, 0, read); + } return tmp.toByteArray(); } }