@Override public void process(InputStream in, OutputStream out) throws IOException { try (Base32OutputStream bos = new Base32OutputStream(out)) { StreamUtils.copy(in, bos); } } }
OutputStream out = new Base32OutputStream(byteOut, true, chunkSize, separator); out.write(decoded); out.close(); out = new Base32OutputStream(byteOut, false); out.write(encoded); out.close(); out = byteOut; for (int i = 0; i < 10; i++) { out = new Base32OutputStream(out, false); out = new Base32OutputStream(out, true, chunkSize, separator);
OutputStream out = new Base32OutputStream(byteOut, true, chunkSize, separator); for (final byte element : decoded) { out.write(element); out = new Base32OutputStream(byteOut, false); for (final byte element : encoded) { out.write(element); out = new Base32OutputStream(byteOut, false); for (final byte element : encoded) { out.write(element); out = byteOut; for (int i = 0; i < 10; i++) { out = new Base32OutputStream(out, false); out = new Base32OutputStream(out, true, chunkSize, separator);
/** * Tests Base32OutputStream.write(null). * * @throws Exception * for some failure scenarios. */ @Test public void testWriteToNullCoverage() throws Exception { final ByteArrayOutputStream bout = new ByteArrayOutputStream(); final Base32OutputStream out = new Base32OutputStream(bout); try { out.write(null, 0, 0); fail("Expcted Base32OutputStream.write(null) to throw a NullPointerException"); } catch (final NullPointerException e) { // Expected } out.close(); }
/** * Tests the problem reported in CODEC-130. Missing / wrong implementation of skip. */ @Test public void testCodec130() throws IOException { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final Base32OutputStream base32os = new Base32OutputStream(bos); base32os.write(StringUtils.getBytesUtf8(STRING_FIXTURE)); base32os.close(); final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); final Base32InputStream ins = new Base32InputStream(bis); // we skip the first character read from the reader ins.skip(1); final byte[] decodedBytes = Base32TestData.streamToBytes(ins, new byte[64]); final String str = StringUtils.newStringUtf8(decodedBytes); assertEquals(STRING_FIXTURE.substring(1), str); }
final byte[] buf = new byte[1024]; final ByteArrayOutputStream bout = new ByteArrayOutputStream(); final Base32OutputStream out = new Base32OutputStream(bout);
@Override public void process(InputStream in, OutputStream out) throws IOException { try (Base32OutputStream bos = new Base32OutputStream(out)) { StreamUtils.copy(in, bos); } } }