com.ensarsarajcic.neovim.java.corerpc.client.RPCConnection
, java.io.Closeable
, java.lang.AutoCloseable
public final class UnixDomainSocketRPCConnection
extends java.lang.Object
implements com.ensarsarajcic.neovim.java.corerpc.client.RPCConnection
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 | Description |
---|---|
UnixDomainSocketRPCConnection(java.io.File path) |
Creates a new
UnixDomainSocketRPCConnection connected to the file on given path
It uses input/output stream provided by UnixDomainSocket created for given file |
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Closes underlying
UnixDomainSocket
Communication is no longer possible after this call |
java.io.InputStream |
getIncomingStream() |
Gets the
InputStream of the underlying UnixDomainSocket |
java.io.OutputStream |
getOutgoingStream() |
Gets the
OutputStream of the underlying UnixDomainSocket |
java.lang.String |
toString() |
public UnixDomainSocketRPCConnection(java.io.File path)
UnixDomainSocketRPCConnection
connected to the file on given path
It uses input/output stream provided by UnixDomainSocket
created for given filepath
- file to use as unix domain socketjava.lang.NullPointerException
- if path is nulljava.lang.RuntimeException
- if socket can't be open for given pathpublic java.io.InputStream getIncomingStream()
InputStream
of the underlying UnixDomainSocket
getIncomingStream
in interface com.ensarsarajcic.neovim.java.corerpc.client.RPCConnection
InputStream
of the underlying UnixDomainSocket
public java.io.OutputStream getOutgoingStream()
OutputStream
of the underlying UnixDomainSocket
getOutgoingStream
in interface com.ensarsarajcic.neovim.java.corerpc.client.RPCConnection
OutputStream
of the underlying UnixDomainSocket
public void close() throws java.io.IOException
UnixDomainSocket
Communication is no longer possible after this callclose
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
java.io.IOException
- if underlying UnixDomainSocket
throws exceptionpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2018. All rights reserved.