Package com.microej.kf.util.control.net
Class SocketOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- com.microej.kf.util.control.net.SocketOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class SocketOutputStream extends FilterOutputStream
Socket output stream wrapper used to control net/ssl write call.
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description SocketOutputStream(Socket socket, OutputStream outputstream)Creates a socket output stream instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this output stream and releases any system resources associated with the stream.voidwrite(byte[] b, int off, int len)Writeslenbytes from the specifiedbytearray starting at offsetoffto this output stream.voidwrite(int b)Writes the specifiedbyteto this output stream.-
Methods inherited from class java.io.FilterOutputStream
flush, write
-
-
-
-
Constructor Detail
-
SocketOutputStream
public SocketOutputStream(Socket socket, OutputStream outputstream) throws IOException
Creates a socket output stream instance.- Parameters:
socket- the socket.outputstream- the underlying output stream.- Throws:
IOException- if an error occurs.
-
-
Method Detail
-
write
public void write(int b) throws IOExceptionDescription copied from class:FilterOutputStreamWrites the specifiedbyteto this output stream.The
writemethod ofFilterOutputStreamcalls thewritemethod of its underlying output stream, that is, it performsout.write(b).Implements the abstract
writemethod ofOutputStream.- Overrides:
writein classFilterOutputStream- Parameters:
b- thebyte.- Throws:
IOException- if an I/O error occurs.
-
write
public void write(byte[] b, int off, int len) throws IOExceptionDescription copied from class:FilterOutputStreamWriteslenbytes from the specifiedbytearray starting at offsetoffto this output stream.The
writemethod ofFilterOutputStreamcalls thewritemethod of one argument on eachbyteto output.Note that this method does not call the
writemethod of its underlying input stream with the same arguments. Subclasses ofFilterOutputStreamshould provide a more efficient implementation of this method.- Overrides:
writein classFilterOutputStream- Parameters:
b- the data.off- the start offset in the data.len- the number of bytes to write.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.write(int)
-
close
public void close() throws IOExceptionDescription copied from class:FilterOutputStreamCloses this output stream and releases any system resources associated with the stream.The
closemethod ofFilterOutputStreamcalls itsflushmethod, and then calls theclosemethod of its underlying output stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.flush(),FilterOutputStream.out
-
-