Class UnixDomainSocketRpcConnection
java.lang.Object
com.ensarsarajcic.neovim.java.unix.socket.UnixDomainSocketRpcConnection
- All Implemented Interfaces:
RpcConnection
,Closeable
,AutoCloseable
Simple implementation of
RpcConnection
based on a unix domain socket
This allows connection and communication via unix domain socket/windows named pipe
It is a very simple implementation and it just passes down calls to underlying UnixDomainSocket
Example:
File socket = new File("/var/nvim/random");
RpcConnection fileConnection = new UnixDomainSocketRpcConnection(socket);
// It can now be used for communication
rpcStreamer.attach(fileConnection);
rpcStreamer.sent(message); // send a message to unix domain socket located on /var/nvim/random
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newUnixDomainSocketRpcConnection
connected to the file on given path It uses input/output stream provided byUnixDomainSocket
created for given file -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes underlyingUnixDomainSocket
Communication is no longer possible after this callGets theInputStream
of the underlyingUnixDomainSocket
Gets theOutputStream
of the underlyingUnixDomainSocket
toString()
-
Constructor Details
-
UnixDomainSocketRpcConnection
Creates a newUnixDomainSocketRpcConnection
connected to the file on given path It uses input/output stream provided byUnixDomainSocket
created for given file- Parameters:
path
- file to use as unix domain socket- Throws:
NullPointerException
- if path is nullRuntimeException
- if socket can't be open for given path
-
-
Method Details
-
getIncomingStream
Gets theInputStream
of the underlyingUnixDomainSocket
- Specified by:
getIncomingStream
in interfaceRpcConnection
- Returns:
InputStream
of the underlyingUnixDomainSocket
-
getOutgoingStream
Gets theOutputStream
of the underlyingUnixDomainSocket
- Specified by:
getOutgoingStream
in interfaceRpcConnection
- Returns:
OutputStream
of the underlyingUnixDomainSocket
-
close
Closes underlyingUnixDomainSocket
Communication is no longer possible after this call- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- if underlyingUnixDomainSocket
throws exception
-
toString
-