net.i2p.util
Class BigPipedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.PipedInputStream
          extended by net.i2p.util.BigPipedInputStream
All Implemented Interfaces:
Closeable

public class BigPipedInputStream
extends PipedInputStream

Java 1.5 PipedInputStream buffers are only 1024 bytes; our I2CP messages are typically 1730 bytes, thus causing thread blockage before the whole message is transferred. We can specify buffer size in 1.6 but not in 1.5. Until we switch to Java 1.6 - http://javatechniques.com/blog/low-memory-deep-copy-technique-for-java-objects/ Moved from InternalServerSocket.

Since:
0.8.9

Field Summary
 
Fields inherited from class java.io.PipedInputStream
buffer, in, out
 
Method Summary
static PipedInputStream getInstance()
          default size 64K
static PipedInputStream getInstance(int size)
           
 
Methods inherited from class java.io.PipedInputStream
available, close, connect, read, read, receive
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static PipedInputStream getInstance()
default size 64K


getInstance

public static PipedInputStream getInstance(int size)