com.java4less.textprinter.ports
Class FilePort

java.lang.Object
  |
  +--com.java4less.textprinter.PrinterPort
        |
        +--com.java4less.textprinter.ports.FilePort
All Implemented Interfaces:
java.lang.Runnable

public class FilePort
extends PrinterPort
implements java.lang.Runnable

Class used to access the printer using a file. For example, in windows you can use:
- "PRN:" for a local printer
- "//server/printername:" for a network printer
- "/dev/lpr": for Linux


Constructor Summary
FilePort(java.lang.String filename)
           
 
Method Summary
 void close()
          closes port
 void open()
          opens port
 void run()
          start writer thread
 void write(byte[] s, int len)
          Writes an array of bytes to the port
 void write(java.lang.String s)
          Writes a string to the port
 
Methods inherited from class com.java4less.textprinter.PrinterPort
getTimeout, isBusy, isInError, isOnline, isPaperOut, setTimeout, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePort

public FilePort(java.lang.String filename)
Method Detail

open

public void open()
          throws TextPrinterException
opens port

Overrides:
open in class PrinterPort
TextPrinterException

close

public void close()
           throws TextPrinterException
closes port

Overrides:
close in class PrinterPort
TextPrinterException

write

public void write(java.lang.String s)
           throws TextPrinterException
Writes a string to the port

Overrides:
write in class PrinterPort
TextPrinterException

write

public void write(byte[] s,
                  int len)
           throws TextPrinterException
Writes an array of bytes to the port

Overrides:
write in class PrinterPort
TextPrinterException

run

public void run()
start writer thread

Specified by:
run in interface java.lang.Runnable