Package org.openmuc.jdlms.transportlayer
Interface StreamAccessor
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Subinterfaces:
TransportLayer
- All Known Implementing Classes:
Iec21Layer
,TcpLayer
,UdpLayer
public interface StreamAccessor extends java.lang.AutoCloseable
Stream accessor interface to access a physical stream to a remote meter.- See Also:
TransportLayer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
java.io.DataInputStream
getInputStream()
Returns the input stream for this stream accessor.java.io.DataOutputStream
getOutpuStream()
Returns the output stream for this stream accessor.void
setTimeout(int timeout)
Enable/disable TIMEOUT with the specified timeout, in milliseconds.
-
-
-
Method Detail
-
setTimeout
void setTimeout(int timeout) throws java.io.IOException
Enable/disable TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on theInputStream
m associated with this StreamAcessor will block for only this amount of time. If the timeout expires, a java.net.SocketTimeoutException is raised, though the Socket is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be> 0
. A timeout of zero is interpreted as an infinite timeout.- Parameters:
timeout
- the specified timeout, in milliseconds.- Throws:
java.io.IOException
- if there is an error in the underlying protocol, such as a TCP error.
-
getInputStream
java.io.DataInputStream getInputStream() throws java.io.IOException
Returns the input stream for this stream accessor.- Returns:
- the input stream.
- Throws:
java.io.IOException
- an I/O error accessing the input stream, the stream accessor is closed, the stream accessor is not connected.
-
getOutpuStream
java.io.DataOutputStream getOutpuStream() throws java.io.IOException
Returns the output stream for this stream accessor.- Returns:
- the output stream.
- Throws:
java.io.IOException
- an I/O error accessing the output stream, the stream accessor is closed, the stream accessor is not connected.
-
close
void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.io.IOException
-
-