Throw EOF exception on EOF.
[sonitus.git] / 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);
        }