All Packages Class Hierarchy This Package Previous Next Index
Class javax.comm.ParallelPort
java.lang.Object
|
+----javax.comm.CommPort
|
+----javax.comm.ParallelPort
- public abstract class ParallelPort
- extends CommPort
A parallel communications port. ParallelPort
describes
the low-level interface to a parallel communications port made available
by the underlying system. ParallelPort
defines the minimum
required functionality for parallel communications ports.
- See Also:
- CommPort, CommPortIdentifier
-
LPT_MODE_ANY
- Picks the best available mode.
-
LPT_MODE_ECP
- Enhanced capabilities port.
-
LPT_MODE_EPP
- Extended parallel port.
-
LPT_MODE_NIBBLE
- Nibble Mode.
-
LPT_MODE_PS2
- Byte mode.
-
LPT_MODE_SPP
- Compatibility mode.
-
ParallelPort()
-
-
addEventListener(ParallelPortEventListener)
- Registers a
ParallelPortEventListener
object for
ParallelPortEvent
s.
-
getMode()
- Gets the currently configured mode.
-
getOutputBufferFree()
- Gets the number of bytes available in the output buffer.
-
isPaperOut()
- Checks if the port is indicating an "Out of Paper" state.
-
isPrinterBusy()
- Checks if the port is indicating a "Printer Busy" state.
-
isPrinterError()
- Checks if the printer has encountered an error.
-
isPrinterSelected()
- Checks if the printer is in selected state.
-
isPrinterTimedOut()
- Checks if the printer has timed out.
-
notifyOnBuffer(boolean)
- Expresses interest in being notified when the output buffer is empty.
-
notifyOnError(boolean)
- Expresses interest in being notified of port errors.
-
removeEventListener()
- Deregisters event listener registered using
addEventListener
.
-
restart()
- Restarts output after an error.
-
setMode(int)
- Sets the printer port mode.
-
suspend()
- Suspends output.
LPT_MODE_ANY
public static final int LPT_MODE_ANY
- Picks the best available mode.
LPT_MODE_SPP
public static final int LPT_MODE_SPP
- Compatibility mode. Unidirectional.
LPT_MODE_PS2
public static final int LPT_MODE_PS2
- Byte mode. Bi-directional.
LPT_MODE_EPP
public static final int LPT_MODE_EPP
- Extended parallel port.
LPT_MODE_ECP
public static final int LPT_MODE_ECP
- Enhanced capabilities port.
LPT_MODE_NIBBLE
public static final int LPT_MODE_NIBBLE
- Nibble Mode. Bi-directional. HP Bi-tronics. 4 bits at a time.
ParallelPort
public ParallelPort()
addEventListener
public abstract void addEventListener(ParallelPortEventListener lsnr) throws TooManyListenersException
- Registers a
ParallelPortEventListener
object for
ParallelPortEvent
s. Interest in specific events
may be expressed by using the notifyOnError
and
notifyOnBuffer
methods.
Only one listener per ParallelPort
is supported.
Calling addEventListener
multiple times will simply
replace the current ParallelPortEventListener
object.
After the port is closed, no more event will be generated. Another
call to open()
of the port's
CommPortIdentifier
object will return a new CommPort
object, and the lsnr
has to be added again to the new CommPort
object to
receive event from this port.
- Parameters:
- lsnr - A
ParallelPortEventListener
object
whose parallelEvent
method will be called
to indicate an event.
- Throws: TooManyListenersException
- If an initial attempt to
attach a listener succeeds, subsequent
attempts will throw TooManyListenersException
without effecting the first listener.
removeEventListener
public abstract void removeEventListener()
- Deregisters event listener registered using
addEventListener
.
This is done automatically when a port is closed.
notifyOnError
public abstract void notifyOnError(boolean notify)
- Expresses interest in being notified of port errors.
- Parameters:
- notify - enable or disable error notification based on whether
notify is true or false
notifyOnBuffer
public abstract void notifyOnBuffer(boolean notify)
- Expresses interest in being notified when the output buffer is empty.
- Parameters:
- boolean -
true
enables notification;
false
disables notification.
getOutputBufferFree
public abstract int getOutputBufferFree()
- Gets the number of bytes available in the output buffer.
- Returns:
- integer value corresponding to the number of bytes available
in the output buffer
isPaperOut
public abstract boolean isPaperOut()
- Checks if the port is indicating an "Out of Paper" state.
- Returns:
- true if printer has run out of paper,
false if printer does not report "Out of paper".
isPrinterBusy
public abstract boolean isPrinterBusy()
- Checks if the port is indicating a "Printer Busy" state.
- Returns:
- true if printer is busy,
false if printer is idle
isPrinterSelected
public abstract boolean isPrinterSelected()
- Checks if the printer is in selected state.
- Returns:
- true if printer is selected,
false if printer is in deselected mode
isPrinterTimedOut
public abstract boolean isPrinterTimedOut()
- Checks if the printer has timed out.
- Returns:
- true if printer has timed out,
false if printer does not report "Out of paper".
isPrinterError
public abstract boolean isPrinterError()
- Checks if the printer has encountered an error.
- Returns:
- true if printer has encountered an error,
false if printer does not report "Out of paper".
restart
public abstract void restart()
- Restarts output after an error.
suspend
public abstract void suspend()
- Suspends output.
getMode
public abstract int getMode()
- Gets the currently configured mode.
- Returns:
- mode returned is one of LPT_MODE_SPP,
LPT_MODE_PS2, LPT_MODE_EPP, or LPT_MODE_ECP
setMode
public abstract int setMode(int mode) throws UnsupportedCommOperationException
- Sets the printer port mode.
- Parameters:
- mode - one of LPT_MODE_ANY, LPT_MODE_SPP,
LPT_MODE_PS2, LPT_MODE_EPP, or LPT_MODE_ECP
- Throws: UnsupportedCommOperationException
- is thrown if the
mode is not supported by the underline driver.
All Packages Class Hierarchy This Package Previous Next Index