Throw EOF exception on EOF.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 16 Mar 2013 17:16:06 +0000 (18:16 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 16 Mar 2013 17:16:06 +0000 (18:16 +0100)
src/main/java/net/pterodactylus/sonitus/data/filter/ExternalFilter.java

index c2f6715..5557fbb 100644 (file)
@@ -67,6 +67,9 @@ public abstract class ExternalFilter implements Filter {
        public byte[] get(int bufferSize) throws EOFException, IOException {
                byte[] buffer = new byte[bufferSize];
                int read = pipedInputStream.read(buffer);
+               if (read == -1) {
+                       throw new EOFException();
+               }
                return Arrays.copyOf(buffer, read);
        }