public interface FileUtil
package test.zebra.sdk.device.examples;
import com.zebra.sdk.comm.Connection;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.comm.TcpConnection;
import com.zebra.sdk.device.ZebraIllegalArgumentException;
import com.zebra.sdk.printer.ZebraPrinter;
import com.zebra.sdk.printer.ZebraPrinterFactory;
import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;
public class FileUtilExample {
public static void main(String[] args) throws Exception {
Connection connection = new TcpConnection("192.168.1.100", TcpConnection.DEFAULT_ZPL_TCP_PORT);
try {
connection.open();
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
printer.sendFileContents("/sdcard/documents/labels/sample.lbl");
String[] fileNames = printer.retrieveFileNames();
for (String filename : fileNames) {
System.out.println(filename);
}
} catch (ConnectionException e) {
e.printStackTrace();
} catch (ZebraPrinterLanguageUnknownException e) {
e.printStackTrace();
} catch (ZebraIllegalArgumentException e) {
e.printStackTrace();
} finally {
connection.close();
}
}
}
Modifier and Type | Method and Description |
---|---|
String[] |
retrieveFileNames()
Retrieves the names of the files which are stored on the device.
|
String[] |
retrieveFileNames(String[] extensions)
Retrieves the names of the files which are stored on the device.
|
List<PrinterObjectProperties> |
retrieveObjectsProperties()
Retrieves the properties of the objects which are stored on the device.
|
void |
sendFileContents(String filePath)
Sends the contents of a file to the device.
|
void |
sendFileContents(String filePath,
ProgressMonitor handler)
Sends the contents of a file to the device.
|
void sendFileContents(String filePath) throws ConnectionException
filePath
- the full file path (e.g. "C:\\Users\\%USERNAME%\\Documents\\sample.lbl").ConnectionException
- if there is an issue communicating with the device (e.g. the connection is not
open).void sendFileContents(String filePath, ProgressMonitor handler) throws ConnectionException
filePath
- the full file path (e.g. "C:\\Users\\%USERNAME%\\Documents\\sample.lbl").handler
- callback to update on progressConnectionException
- if there is an issue communicating with the device (e.g. the connection is not
open).String[] retrieveFileNames() throws ConnectionException, ZebraIllegalArgumentException
ConnectionException
- if there is an error connecting to the device.ZebraIllegalArgumentException
- if there is an error parsing the directory data returned by the device.String[] retrieveFileNames(String[] extensions) throws ConnectionException, ZebraIllegalArgumentException
extensions
.extensions
- the extensions to filter on.ConnectionException
- If there is an error connecting to the device.ZebraIllegalArgumentException
- if there is an error parsing the directory data returned by the device.List<PrinterObjectProperties> retrieveObjectsProperties() throws ConnectionException, ZebraIllegalArgumentException
ConnectionException
- If there is an error connecting to the device.ZebraIllegalArgumentException
- if there is an error parsing the directory data returned by the device.
© 2016 ZIH Corp. All Rights Reserved.