Test Blame

src/test/java/org/apache/commons/compress/utils/CountingStreamTest.java
TagDateBlameLineSource
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  49
    @Test
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  50
    public void input() throws Exception {
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  51
        // I don't like "test all at once" tests either, but the class
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  52
        // is soo trivial
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  53
        ByteArrayInputStream bis =
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  54
            new ByteArrayInputStream(new byte[] { 1, 2, 3, 4 });
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  55
        CountingInputStream i = new CountingInputStream(bis);
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  56
        assertEquals(1, i.read());
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  57
        assertEquals(1, i.getBytesRead());
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  58
        byte[] b = new byte[2];
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  59
        i.read(b);
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  60
        assertEquals(3, i.getBytesRead());
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  61
        assertArrayEquals(new byte[] { 2, 3 }, b);
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  62
        b = new byte[3];
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  63
        i.read(b, 1, 1);
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  64
        assertArrayEquals(new byte[] { 0, 4, 0 }, b);
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  65
        assertEquals(4, i.getBytesRead());
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  66
        i.count(-1);
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  67
        assertEquals(4, i.getBytesRead());
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  68
        i.count(-2);
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  69
        assertEquals(2, i.getBytesRead());
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  70
        i.close();
  COMPRESS_1.3_RC2    Wed Oct 26 10:56:25 UTC 2011    cb384b  71
    }

Found Source Blame

src/main/java/org/apache/commons/compress/utils/CountingInputStream.java
TagDateBlameLineSource
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  34
        super(in);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  35
    }
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  39
        int r = in.read();
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  40
        if (r >= 0) {
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  41
            count(1);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  43
        return r;
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  47
        return read(b, 0, b.length);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  51
        int r = in.read(b, off, len);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  52
        if (r >= 0) {
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  53
            count(r);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  55
        return r;
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  64
        if (read != -1) {
  COMPRESS_1.3_RC1    Tue Oct 25 10:59:19 UTC 2011    267a33  65
            bytesRead += read;
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  67
    }
  COMPRESS_1.3_RC1    Tue Oct 25 10:59:19 UTC 2011    267a33  74
        return bytesRead;
src/main/java/org/apache/commons/compress/utils/CountingOutputStream.java
TagDateBlameLineSource
  COMPRESS_1.3_RC1    Tue Oct 25 10:59:19 UTC 2011    267a33  31
    private long bytesWritten = 0;
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  34
        super(out);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  35
    }
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  39
        out.write(b);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  40
        count(1);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  41
    }
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  44
        write(b, 0, b.length);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  45
    }
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  48
        out.write(b, off, len);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  49
        count(len);
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  50
    }
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  59
        if (written != -1) {
  COMPRESS_1.3_RC1    Tue Oct 25 10:59:19 UTC 2011    267a33  60
            bytesWritten += written;
  COMPRESS_1.3_RC1    Sun Oct 23 11:48:59 UTC 2011    41fc7c  62
    }
  COMPRESS_1.3_RC1    Tue Oct 25 10:59:19 UTC 2011    267a33  69
        return bytesWritten;