Package com._1c.g5.v8.dt.common.io
Class TimeoutReader
java.lang.Object
java.io.Reader
com._1c.g5.v8.dt.common.io.TimeoutReader
- All Implemented Interfaces:
 Closeable,AutoCloseable,Readable
Reads text from a parent reader with the given timeout.
 
 Each read request causes a TimeoutReader request an underlying reader to read with
 the specified timeout. IOException will be thrown, if timeout is reached.
 Clients may wrap a TimeoutReader around any input stream reader whose read()
 operations may hang out, such as Process.getInputStream().
 Example of usage:
 
 // reads process input with 10 seconds timeout
 try (TimeoutReader reader = new TimeoutReader(
     new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8), 10 * 1000))
 {
     ...
 }
 - 
Field Summary
 - 
Constructor Summary
ConstructorsConstructorDescriptionTimeoutReader(Reader input, int timeout) Creates aTimeoutReaderthat has a given timeout in milliseconds.TimeoutReader(Reader input, int timeout, TimeUnit timeUnit) Creates aTimeoutReaderthat has a given timeout. - 
Method Summary
Methods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferTo 
- 
Constructor Details
- 
TimeoutReader
Creates aTimeoutReaderthat has a given timeout in milliseconds.- Parameters:
 input- the parent reader to wrap, cannot benulltimeout- the maximum time to wait in milliseconds
 - 
TimeoutReader
Creates aTimeoutReaderthat has a given timeout.- Parameters:
 input- the parent reader to wrap, cannot benulltimeout- the maximum time to waittimeUnit- the time unit of thetimeoutargument
 
 - 
 - 
Method Details
- 
read
- Specified by:
 readin classReader- Throws:
 IOException
 - 
close
- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceCloseable- Specified by:
 closein classReader- Throws:
 IOException
 
 -