public final class SaneSession
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection to the SANE server.
|
SaneDevice |
getDevice(java.lang.String name)
Returns the device with the give name.
|
SanePasswordProvider |
getPasswordProvider()
Returns the current password provider.
|
java.util.List<SaneDevice> |
listDevices()
Lists the devices known to the SANE daemon.
|
void |
setPasswordProvider(SanePasswordProvider passwordProvider)
Sets the
password provider to use if the SANE daemon asks for
credentials when accessing a resource. |
static SaneSession |
withRemoteSane(java.net.InetAddress saneAddress)
Establishes a connection to the SANE daemon running on the given host on the default SANE port
with no connection timeout.
|
static SaneSession |
withRemoteSane(java.net.InetAddress saneAddress,
int port)
Establishes a connection to the SANE daemon running on the given host on the given port with no
connection timeout.
|
static SaneSession |
withRemoteSane(java.net.InetAddress saneAddress,
int port,
long timeout,
java.util.concurrent.TimeUnit timeUnit)
Establishes a connection to the SANE daemon running on the given host on the given port.
|
static SaneSession |
withRemoteSane(java.net.InetAddress saneAddress,
long timeout,
java.util.concurrent.TimeUnit timeUnit)
Establishes a connection to the SANE daemon running on the given host on the default SANE port
with the given connection timeout.
|
public SanePasswordProvider getPasswordProvider()
SanePasswordProvider.usingDotSanePassFile(), but you may override that with
setPasswordProvider(au.com.southsky.jfreesane.SanePasswordProvider).public void setPasswordProvider(SanePasswordProvider passwordProvider)
password provider to use if the SANE daemon asks for
credentials when accessing a resource.public static SaneSession withRemoteSane(java.net.InetAddress saneAddress) throws java.io.IOException
java.io.IOExceptionpublic static SaneSession withRemoteSane(java.net.InetAddress saneAddress, long timeout, java.util.concurrent.TimeUnit timeUnit) throws java.io.IOException
java.io.IOExceptionpublic static SaneSession withRemoteSane(java.net.InetAddress saneAddress, int port) throws java.io.IOException
java.io.IOExceptionpublic static SaneSession withRemoteSane(java.net.InetAddress saneAddress, int port, long timeout, java.util.concurrent.TimeUnit timeUnit) throws java.io.IOException
SocketTimeoutException is thrown.java.io.IOExceptionpublic SaneDevice getDevice(java.lang.String name) throws java.io.IOException
SaneDevice with the given name associated with the current session, never
nulljava.io.IOException - if an error occurs while communicating with the SANE daemonpublic java.util.List<SaneDevice> listDevices() throws java.io.IOException, SaneException
SaneDevice.open()java.io.IOException - if an error occurs while communicating with the SANE daemonSaneException - if the SANE backend returns an error in response to this requestpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException - if an error occurred while closing the connection