equal
deleted
inserted
replaced
48 int position = random.nextInt(SIZE/2); |
48 int position = random.nextInt(SIZE/2); |
49 int size = random.nextInt(SIZE - position); |
49 int size = random.nextInt(SIZE - position); |
50 |
50 |
51 ByteArrayInputStream bais = |
51 ByteArrayInputStream bais = |
52 new ByteArrayInputStream(buf, position, size); |
52 new ByteArrayInputStream(buf, position, size); |
53 int off = random.nextInt(size / 2); |
53 int off = size < 2 ? 0 : random.nextInt(size / 2); |
54 int len = random.nextInt(size - off); |
54 int len = size - off < 1 ? 0 : random.nextInt(size - off); |
55 |
55 |
56 byte[] bN = new byte[off + len]; |
56 byte[] bN = new byte[off + len]; |
57 if (bais.readNBytes(bN, off, len) != len) { |
57 if (bais.readNBytes(bN, off, len) != len) { |
58 throw new RuntimeException("readNBytes return value"); |
58 throw new RuntimeException("readNBytes return value"); |
59 } |
59 } |