public class SaneDevice
extends java.lang.Object
implements java.io.Closeable
SaneSession.
Definitely not thread-safe. If you're going to use this object from multiple threads, you must do your own synchronization. Even performing read operations (like getting an option's value) must be synchronized.
| Modifier and Type | Method and Description |
|---|---|
java.awt.image.BufferedImage |
acquireImage()
Acquires a single image from the Sane daemon.
|
java.awt.image.BufferedImage |
acquireImage(ScanListener listener)
Acquires a single image from the Sane daemon.
|
void |
cancel()
Cancel the current operation of a remote SANE device.
|
void |
close()
Closes the device.
|
java.lang.String |
getModel() |
java.lang.String |
getName() |
SaneOption |
getOption(java.lang.String title)
Returns the option with the given name for this device.
|
java.util.List<OptionGroup> |
getOptionGroups()
Returns the list of option groups for this device.
|
java.lang.String |
getType() |
java.lang.String |
getVendor() |
boolean |
isOpen()
Returns
true if the device is open. |
java.util.List<SaneOption> |
listOptions()
Returns the list of options applicable to this device.
|
void |
open()
Opens the device.
|
java.lang.String |
toString() |
public java.lang.String getName()
public java.lang.String getVendor()
public java.lang.String getModel()
public java.lang.String getType()
public boolean isOpen()
true if the device is open.public void open()
throws java.io.IOException,
SaneException
java.io.IOException - if a problem occurred while talking to SANESaneExceptionjava.lang.IllegalStateException - if the device is already openpublic java.awt.image.BufferedImage acquireImage()
throws java.io.IOException,
SaneException
BufferedImage representing the image obtained from Sanejava.io.IOException - if an error occurred while talking to the backendSaneException - if an application-level error was returned by the Sane daemonpublic java.awt.image.BufferedImage acquireImage(ScanListener listener) throws java.io.IOException, SaneException
ScanListener will be notified
about updates during the scan.
The scanning thread will be used to make calls to listener. Scanning will not proceed
until control returns to JFreeSane, so your implementation should not monopolize this thread
for longer than necessary.
listener - if not null, this object will receive notifications about scan progressBufferedImage representing the image obtained from Sanejava.io.IOException - if an error occurred while talking to the backendSaneException - if an application-level error was returned by the Sane daemonpublic void cancel()
throws java.io.IOException
java.io.IOException - if an error occurs talking to the SANE backendjava.lang.IllegalStateException - if the device is not openpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException - if an error occurs talking to the SANE backendjava.lang.IllegalStateException - if the device is already closedpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.util.List<SaneOption> listOptions() throws java.io.IOException
SaneOption instancesjava.io.IOException - if a problem occurred talking to the SANE backendpublic java.util.List<OptionGroup> getOptionGroups() throws java.io.IOException
java.io.IOExceptionpublic SaneOption getOption(java.lang.String title) throws java.io.IOException
null is returned. Name matching is case-sensitive.java.io.IOException