Lines Matching refs:length

42             InputStream is = new LimitedLengthInputStream(mTestStream1, -1, TEST_STRING1.length);
53 fail("Should throw IOException on negative length");
74 fail("Should fail when offset + length is > Long.MAX_VALUE");
80 private void checkReadBytesWithOffsetAndLength_WithString1(int offset, int length)
82 byte[] temp = new byte[TEST_STRING1.length];
83 byte[] expected = new byte[length];
84 byte[] actual = new byte[length];
86 System.arraycopy(TEST_STRING1, offset, expected, 0, length);
88 InputStream is = new LimitedLengthInputStream(mTestStream1, offset, length);
89 assertEquals(length, is.read(temp, 0, temp.length));
91 System.arraycopy(temp, 0, actual, 0, length);
94 assertEquals(-1, is.read(temp, 0, temp.length));
111 checkReadBytesWithOffsetAndLength_WithString1(0, TEST_STRING1.length);
117 checkReadBytesWithOffsetAndLength_WithString1(3, TEST_STRING1.length - 3);
122 byte[] temp = new byte[TEST_STRING1.length + 10];
123 InputStream is = new LimitedLengthInputStream(mTestStream1, 0, TEST_STRING1.length + 10);
124 assertEquals(TEST_STRING1.length, is.read(temp, 0, TEST_STRING1.length + 10));
126 byte[] actual = new byte[TEST_STRING1.length];
127 System.arraycopy(temp, 0, actual, 0, actual.length);
131 private void checkReadBytes_WithString1(int offset, int length) throws Exception {
132 byte[] temp = new byte[TEST_STRING1.length];
133 byte[] expected = new byte[length];
134 byte[] actual = new byte[length];
136 System.arraycopy(TEST_STRING1, offset, expected, 0, length);
138 InputStream is = new LimitedLengthInputStream(mTestStream1, offset, length);
139 assertEquals(length, is.read(temp));
141 System.arraycopy(temp, 0, actual, 0, length);
159 checkReadBytesWithOffsetAndLength_WithString1(0, TEST_STRING1.length);
164 checkReadBytesWithOffsetAndLength_WithString1(3, TEST_STRING1.length - 3);
167 private void checkSingleByteRead_WithString1(int offset, int length) throws Exception {
168 InputStream is = new LimitedLengthInputStream(mTestStream1, offset, length);
170 for (int i = 0; i < length; i++) {
189 checkSingleByteRead_WithString1(0, TEST_STRING1.length);
194 checkSingleByteRead_WithString1(3, TEST_STRING1.length - 3);