while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes;
while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes;
while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes;
while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes;
while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes;
while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes;
int b; for (i = 0; i < len; i++) { b = read();
int b; for (i = 0; i < len; i++) { b = read();
int b; for (i = 0; i < len; i++) { b = read();
@Test @FixFor("MODE-2413") public void shouldSupportReadingFromSelfClosingInputStream() throws Exception { byte[] buffer = new byte[1024]; ByteArrayOutputStream bos = new ByteArrayOutputStream(); URL resource = getClass().getResource("simple.json"); try (Base64.InputStream is = new Base64.InputStream(new SelfClosingInputStream(resource.openStream()), Base64.ENCODE)) { int read; while ((read = is.read(buffer, 0, buffer.length)) != -1) { bos.write(buffer, 0, read); } } // until Java 8, use this.... String expectedString = DatatypeConverter.printBase64Binary(IoUtil.readBytes(resource.openStream())); assertEquals("Incorrect Base64 encoding", expectedString, new String(bos.toByteArray())); } }