public abstract class Printer
extends java.lang.Object
Constructors and instructions |
---|
Printer() |
Qualifiers and types | Methods and instructions |
---|---|
abstract void |
close()
Turn off the printer
If the printer is no longer used (such as when Activity exits), it should turn off its serial port Otherwise it will always occupy the printer, the other App will not be able to use the printer. |
abstract void |
cut()
Send a cut instruction
|
static SerialPortConfiguration |
getConfiguration()
Get the printer's serial configuration information for writing your own serial print class.
|
abstract java.io.InputStream |
getInputStream()
Gets the data stream of the output interface.
|
abstract java.io.OutputStream |
getOutputStream()
Gets the data stream of the output interface.
|
static Printer |
newInstance()
Create a Printer instance
|
abstract void |
print(byte[] data)
Send an instruction or text to the printer
|
abstract void |
print(java.lang.String data)
Send an instruction or text to the printer
|
abstract int |
read(byte[] data)
Read data (usually used to send the query command, read the printer's return data)
|
abstract int |
readStatus()
Read the printer status (only the serial printer is valid)
|
abstract boolean |
ready()
Check if the printer is online
|
abstract void |
write(byte[] data)
Send data (can be a character or bytecode instruction)
|
public static SerialPortConfiguration getConfiguration() throws java.lang.Throwable
java.lang.Exception
java.lang.Throwable
public static Printer newInstance() throws java.lang.Throwable
java.lang.Exception
java.lang.Throwable
public abstract void close()
public abstract int readStatus() throws java.io.IOException
java.io.IOException
public abstract boolean ready() throws java.io.IOException
java.io.IOException
public abstract void print(java.lang.String data) throws java.io.IOException
data
- Character or bytecode instructions, the instructions used must refer to the "Printer Programming Manual"java.io.IOException
public abstract void print(byte[] data) throws java.io.IOException
data
- Character or bytecode instructions, the instructions used must refer to the "Printer Programming Manual"java.io.IOException
public abstract void cut() throws java.io.IOException
java.io.IOException
public abstract void write(byte[] data) throws java.io.IOException
data
- java.io.IOException
public abstract int read(byte[] data) throws java.io.IOException
java.io.IOException
public abstract java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public abstract java.io.OutputStream getOutputStream() throws java.io.IOException
java.io.IOException