Fix CapturingOutputStream size accounting
[yangtools.git] / plugin / yang-maven-plugin / src / main / java / org / opendaylight / yangtools / yang2sources / plugin / CapturingOutputStream.java
index c66283ddb4212d6195b84464110a24b380a8dc2e..51f773a3cf921e6c07963c1ff2b98972aeea64d2 100644 (file)
@@ -26,13 +26,14 @@ final class CapturingOutputStream extends FilterOutputStream {
     @Override
     @SuppressWarnings("checkstyle:parameterName")
     public void write(final int b) throws IOException {
-        super.write(b);
+        out().write(b);
         size++;
     }
 
     @Override
-    public void write(final byte[] bytes, final int off, final int len) throws IOException {
-        super.write(bytes, off, len);
+    @SuppressWarnings("checkstyle:parameterName")
+    public void write(final byte[] b, final int off, final int len) throws IOException {
+        out().write(b, off, len);
         size += len;
     }
 
@@ -41,6 +42,10 @@ final class CapturingOutputStream extends FilterOutputStream {
     }
 
     int crc32c() {
-        return ((HashingOutputStream) out).hash().asInt();
+        return out().hash().asInt();
+    }
+
+    private HashingOutputStream out() {
+        return (HashingOutputStream) out;
     }
 }