PipedOutputStream extends OutputStream { @Override public String toString() { synchronized (sync) { if (buffer == null) { return "PipedOutputStream{readers=" + nrReadStreams + ", startIdx=" + startIdx + ", endIdx=" + endIdx + ", readerPerceivedEndIdx=" + readerPerceivedEndIdx + ", closed=" + writerClosed + '}'; } else { return "PipedOutputStream{readers=" + nrReadStreams + ", bufferLength=" + buffer.length + ", startIdx=" + startIdx + ", endIdx=" + endIdx + ", readerPerceivedEndIdx=" + readerPerceivedEndIdx + ((writerClosed) ? ", closed=" + writerClosed : ", unread=" + BaseEncoding.base64().encode(getUnreadBytesFromBuffer())) + '}'; } } } PipedOutputStream();  PipedOutputStream(final int bufferSize); @Deprecated  PipedOutputStream(final int bufferSize, final long globalDeadlineMillis);  PipedOutputStream(final long globalDeadlineNanos, final int bufferSize);  PipedOutputStream(final int bufferSize,
          final SizedRecyclingSupplier<byte[]> bufferProvider); @Deprecated  PipedOutputStream(final int bufferSize,
          final SizedRecyclingSupplier<byte[]> bufferProvider, @Nullable final Long globalDeadlineMillis);  PipedOutputStream(@Nullable final Long globalDeadlineNanos, final int bufferSize,
          final SizedRecyclingSupplier<byte[]> bufferProvider); @Override void write(final byte[] b, final int off, final int len); long getNanoDeadline(); void writeUntil(final byte[] b, final int off, final int len, final long deadlineNanos); @Override void write(final int b); void writeUntil(final int b, final long deadlineNanos); @Override void flush(); @Override @DischargesObligation void close(); @DischargesObligation void close(final Exception ex); InputStream getInputStream(); synchronized byte[] getUnreadBytesFromBuffer(); @Override String toString();  }
@Test public void testStreamPiping() throws IOException { test("This is a super cool, mega dupper test string for testing piping..........E", 8, false); final IntMath.XorShift32 random = new IntMath.XorShift32(); for (int i = 0; i < 100; i++) { int nrChars = Math.abs(random.nextInt() % 100000); StringBuilder sb = generateTestStr(nrChars); test(sb.toString(), Math.abs(random.nextInt() % 10000) + 2, false); } test(generateTestStr(133).toString(), 2, false); }