Package net.i2p.util
Class TimeoutPipedInputStream
java.lang.Object
java.io.InputStream
java.io.PipedInputStream
net.i2p.util.TimeoutPipedInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Adds setReadTimeout().
Must be used with a TimeoutPipedOutputStream.
To support InternalSocket.setSoTimeout().
Package private, not a part of the public API, not for general use.
- Since:
- 0.9.34
-
Field Summary
Fields inherited from class java.io.PipedInputStream
buffer, in, out, PIPE_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Overridden to save state.int
read()
void
setReadTimeout
(int ms) Must be called before blocking read call.(package private) void
To save state.Methods inherited from class java.io.PipedInputStream
available, connect, read, receive
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
TimeoutPipedInputStream
public TimeoutPipedInputStream(int pipeSize)
-
-
Method Details
-
read
- Overrides:
read
in classPipedInputStream
- Throws:
SocketTimeoutException
- if timeout is reachedIOException
-
setReadTimeout
public void setReadTimeout(int ms) Must be called before blocking read call.- Parameters:
ms
- less than or equal to zero means forever
-
x_receivedLast
void x_receivedLast()To save state. We have to do this because can't get to closedByWriter in super. -
close
Overridden to save state. We have to do this because can't get to closedByReader in super- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classPipedInputStream
- Throws:
IOException
-