Package com.zebra.sdk.device
Interface FileUtilLinkOs
- All Known Subinterfaces:
ZebraPrinterLinkOs
- All Known Implementing Classes:
Profile
public interface FileUtilLinkOs
The
FileUtilLinkOs interface provides methods for managing files on Zebra printers running Link-OS. It allows
applications to retrieve storage information, upload and download files, and delete files on the printer's file
system. The interface supports both standard and protected (password-authenticated) file operations, as well as file
transfers via FTP.
Note: When uploading files that contain printer commands, use the appropriate methods to ensure correct processing by the printer.
Typical Usage:
- Query available storage drives and their details.
- Store files on the printer, specifying the destination path and file name.
- Retrieve files from the printer as byte arrays or write them directly to output streams.
- Delete files from the printer, with support for wildcards and password protection.
- Perform file operations over FTP for network-connected printers with FTP enabled.
Exceptions:
ConnectionException- Thrown when there is an error communicating with the printer.IOException- Thrown when there is an issue reading or writing files.ZebraIllegalArgumentException- Thrown for invalid file paths, names, or arguments.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteFile(String filePath) Deletes a file at the specified file path.voiddeleteFileOnPrinterProtected(String filePath, String authPassword) Deletes the file from the printer on protected mode.voidgetObjectFromPrinter(OutputStream destinationStream, String filePath) Retrieves a file from the printer's file system and writes the contents of that file to destinationStream.byte[]getObjectFromPrinter(String filePath) Retrieves a file from the printer's file system and returns the contents of that file as a byte array.voidgetObjectFromPrinterViaFtp(OutputStream destinationStream, String filePath, String ftpPassword) Retrieves a file from the printer's file system via FTP and writes the contents of that file to destinationStream.byte[]getObjectFromPrinterViaFtp(String filePath, String ftpPassword) Retrieves a file from the printer's file system via FTP and returns the contents of that file as a byte array.byte[]Retrieves a file from the printer's file system and returns the contents of that file as a byte array including all necessary file wrappers for redownloading to a Zebra printer.Retrieves storage information for all of the printer's available drives.voidstoreFileOnPrinter(byte[] fileContents, String fileNameOnPrinter) Stores a file on the printer namedfileNameOnPrinterwith the file contents fromfileContentsusing any required file wrappers.voidstoreFileOnPrinter(String filePath) Stores the file on the printer using any required file wrappers.voidstoreFileOnPrinter(String filePath, String fileNameOnPrinter) Stores the file on the printer at the specified location using specified name using any required file wrappers.voidstoreFileOnPrinterProtected(String filePath, String authPassword) Stores the file on the printer in Protected Mode, available at the specified location and provided authentication password using the required file wrapper(s).voidstoreFileOnPrinterProtected(String filePath, String fileNameOnPrinter, String authPassword) Stores the file on the printer in Protected Mode, available at the specified location, with the specified name and provided authentication password using the required file wrapper(s).
-
Method Details
-
getStorageInfo
Retrieves storage information for all of the printer's available drives.- Returns:
- A list of objects detailing information about the printer's available drives.
- Throws:
ConnectionException- if there is an error connecting to the device.- See Also:
-
storeFileOnPrinter
void storeFileOnPrinter(String filePath) throws ConnectionException, IOException, ZebraIllegalArgumentException Stores the file on the printer using any required file wrappers. Filenames will be truncated to 8.3 format.
Note: If the contents offilePathcontains any commands which need to be processed by the printer, useFileUtil.sendFileContents(String)instead. These commands include download commands and any immediate commands (~CC, ~CD, ~DB, ~DE, ~DG, ~DY, ~EG, ~HI, ~HU, ~HM, ~HQ, ~HS, ~JA, ~JB, ~JC, ~JD, ~JE, ~JF, ~JG, ~JI, ~JL, ~JN, ~JO, ~JP, ~JQ, ~JR, ~JS, ~JX, ~NC, ~NT, ~PL, ~PP, ~PR, ~PS, ~RO, ~SD, ~TA, ~WC, ~WQ, ^DF)- Parameters:
filePath- the full file path (e.g. "C:\\Users\\%USERNAME%\\Documents\\sample.zpl").- Throws:
ConnectionException- if there is an error connecting to the device.IOException- if there is an issue reading the fileZebraIllegalArgumentException- if filePath cannot be used to create a printer file name.
-
storeFileOnPrinter
void storeFileOnPrinter(String filePath, String fileNameOnPrinter) throws ConnectionException, IOException, ZebraIllegalArgumentException Stores the file on the printer at the specified location using specified name using any required file wrappers. The filename can be up to 16 characters long.
Note: If the contents offilePathcontains any commands which need to be processed by the printer, useFileUtil.sendFileContents(String)instead. These commands include download commands and any immediate commands (~CC, ~CD, ~DB, ~DE, ~DG, ~DY, ~EG, ~HI, ~HU, ~HM, ~HQ, ~HS, ~JA, ~JB, ~JC, ~JD, ~JE, ~JF, ~JG, ~JI, ~JL, ~JN, ~JO, ~JP, ~JQ, ~JR, ~JS, ~JX, ~NC, ~NT, ~PL, ~PP, ~PR, ~PS, ~RO, ~SD, ~TA, ~WC, ~WQ, ^DF) `- Parameters:
filePath- the full file path (e.g. "C:\\Users\\%USERNAME%\\Documents\\sample.zpl").fileNameOnPrinter- the full name of the file on the printer (e.g "R:SAMPLE.ZPL").- Throws:
ConnectionException- if there is an error connecting to the device.IOException- if there is an issue reading the fileZebraIllegalArgumentException- if fileNameOnPrinter is not a legal printer file name.
-
storeFileOnPrinter
void storeFileOnPrinter(byte[] fileContents, String fileNameOnPrinter) throws ConnectionException, ZebraIllegalArgumentException Stores a file on the printer namedfileNameOnPrinterwith the file contents fromfileContentsusing any required file wrappers. The filename can be up to 16 characters long.
Note: If thefileContentscontains any commands which need to be processed by the printer, useFileUtil.sendFileContents(String)instead. These commands include download commands and any immediate commands (~CC, ~CD, ~DB, ~DE, ~DG, ~DY, ~EG, ~HI, ~HU, ~HM, ~HQ, ~HS, ~JA, ~JB, ~JC, ~JD, ~JE, ~JF, ~JG, ~JI, ~JL, ~JN, ~JO, ~JP, ~JQ, ~JR, ~JS, ~JX, ~NC, ~NT, ~PL, ~PP, ~PR, ~PS, ~RO, ~SD, ~TA, ~WC, ~WQ, ^DF)- Parameters:
fileContents- The contents of the file to store.fileNameOnPrinter- the full name of the file on the printer (e.g "R:SAMPLE.ZPL").- Throws:
ConnectionException- if there is an error connecting to the device.ZebraIllegalArgumentException- if fileNameOnPrinter is not a legal printer file name.
-
storeFileOnPrinterProtected
void storeFileOnPrinterProtected(String filePath, String authPassword) throws ConnectionException, IOException, ZebraIllegalArgumentException Stores the file on the printer in Protected Mode, available at the specified location and provided authentication password using the required file wrapper(s). This method provides authentication to store NRD, NRE and PAC file types from the local file system to the printer's file system. Filenames will be truncated to 8.3 format.
Note: If thefileContentscontains any commands which need to be processed by the printer, useFileUtil.sendFileContents(String)instead. These commands include download commands and any immediate commands (~CC, ~CD, ~DB, ~DE, ~DG, ~DY, ~EG, ~HI, ~HU, ~HM, ~HQ, ~HS, ~JA, ~JB, ~JC, ~JD, ~JE, ~JF, ~JG, ~JI, ~JL, ~JN, ~JO, ~JP, ~JQ, ~JR, ~JS, ~JX, ~NC, ~NT, ~PL, ~PP, ~PR, ~PS, ~RO, ~SD, ~TA, ~WC, ~WQ, ^DF)- Parameters:
filePath- the full file path (e.g. "C:\\Users\\%USERNAME%\\Documents\\sample.NRD").authPassword- the password required to access the stored file on the printer- Throws:
ConnectionException- if there is an error connecting to the device.IOException- if there is an issue reading the fileZebraIllegalArgumentException- if filePath cannot be used to create a printer file name or if authPassword is null or empty.
-
storeFileOnPrinterProtected
void storeFileOnPrinterProtected(String filePath, String fileNameOnPrinter, String authPassword) throws ConnectionException, IOException, ZebraIllegalArgumentException Stores the file on the printer in Protected Mode, available at the specified location, with the specified name and provided authentication password using the required file wrapper(s).This method provides authentication to store NRD, NRE and PAC file types from the local file system to the printer's file system. The filename can be up to 16 characters long.
Note: If the
fileContentscontains any commands which need to be processed by the printer, useFileUtil.sendFileContents(String)instead. These commands include download commands and any immediate commands (~CC, ~CD, ~DB, ~DE, ~DG, ~DY, ~EG, ~HI, ~HU, ~HM, ~HQ, ~HS, ~JA, ~JB, ~JC, ~JD, ~JE, ~JF, ~JG, ~JI, ~JL, ~JN, ~JO, ~JP, ~JQ, ~JR, ~JS, ~JX, ~NC, ~NT, ~PL, ~PP, ~PR, ~PS, ~RO, ~SD, ~TA, ~WC, ~WQ, ^DF)- Parameters:
filePath- the path to the file on the local system to be storedfileNameOnPrinter- the desired name for the file when stored on the printerauthPassword- the password required to store file on the protected printer- Throws:
ConnectionException- if a connection error occurs while communicating with the printerIOException- if an I/O error occurs during file transferZebraIllegalArgumentException- if any of the provided arguments are invalid or null
-
deleteFileOnPrinterProtected
void deleteFileOnPrinterProtected(String filePath, String authPassword) throws ConnectionException, ZebraIllegalArgumentException Deletes the file from the printer on protected mode. ThefilePathmay also contain wildcards. When a NRD, NRE and PAC type files is in protected mode printer, it deletes file using the provided authentication password.- Parameters:
filePath- the location of the file on the printer. Wildcards are also accepted (e.g. "E:FORMAT.NRD", "E:*.*")authPassword- the password required to access the stored file on the protected printer- Throws:
ConnectionException- if a connection error occurs while communicating with the printerZebraIllegalArgumentException- if any of the provided arguments are invalid or null
-
deleteFile
Deletes a file at the specified file path.- Parameters:
filePath- the path of the file to be deleted- Throws:
ConnectionException- if a connection error occurs while attempting to delete the file
-
getObjectFromPrinter
byte[] getObjectFromPrinter(String filePath) throws ConnectionException, ZebraIllegalArgumentException Retrieves a file from the printer's file system and returns the contents of that file as a byte array. Will retrieve the following file extensions: ZPL, GRF, DAT, BAS, FMT, PNG, LBL, PCX, BMP, WML, CSV, HTM, TXT.
Files transferred between different printer models may not be compatible.- Parameters:
filePath- absolute file path on the printer ("E:SAMPLE.TXT").- Returns:
- The file contents
- Throws:
ConnectionException- if there is an issue communicating with the device (e.g. the connection is not open).ZebraIllegalArgumentException- if the filePath is invalid, or if the file does not exist on the printer.
-
getObjectFromPrinter
void getObjectFromPrinter(OutputStream destinationStream, String filePath) throws ConnectionException, ZebraIllegalArgumentException Retrieves a file from the printer's file system and writes the contents of that file to destinationStream. Will retrieve the following file extensions: ZPL, GRF, DAT, BAS, FMT, PNG, LBL, PCX, BMP, WML, CSV, HTM, TXT.
Files transferred between different printer models may not be compatible.- Parameters:
destinationStream- output stream to receive the file contentsfilePath- absolute file path on the printer ("E:SAMPLE.TXT").- Throws:
ConnectionException- if there is an issue communicating with the device (e.g. the connection is not open).ZebraIllegalArgumentException- if the filePath is invalid, or if the file does not exist on the printer.
-
getObjectFromPrinterViaFtp
byte[] getObjectFromPrinterViaFtp(String filePath, String ftpPassword) throws ConnectionException, ZebraIllegalArgumentException Retrieves a file from the printer's file system via FTP and returns the contents of that file as a byte array. Will retrieve the following file extensions: ZPL, GRF, DAT, BAS, FMT, PNG, LBL, PCX, BMP, WML, CSV, HTM, TXT.
Files transferred between different printer models may not be compatible.
NOTE: This method retrieves files over a network protocol and hence will only work over a TCP connected printer with FTP enabled. IfftpPasswordis not provided, a default will be tried.- Parameters:
filePath- absolute file path on the printer ("E:SAMPLE.TXT")ftpPassword- password used to login to FTP, if null, a default password ("1234") will be used.- Returns:
- The file contents.
- Throws:
ConnectionException- if there is an error communicating with the printer, or the ftpPassword is invalidZebraIllegalArgumentException- if the filePath is invalid, or if the file does not exist on the printer.
-
getObjectFromPrinterViaFtp
void getObjectFromPrinterViaFtp(OutputStream destinationStream, String filePath, String ftpPassword) throws ConnectionException, ZebraIllegalArgumentException Retrieves a file from the printer's file system via FTP and writes the contents of that file to destinationStream. Will retrieve the following file extensions: ZPL, GRF, DAT, BAS, FMT, PNG, LBL, PCX, BMP, WML, CSV, HTM, TXT.
Files transferred between different printer models may not be compatible.
NOTE: This method retrieves files over a network protocol and hence will only work over a TCP connected printer with FTP enabled. IfftpPasswordis not provided, a default will be tried.- Parameters:
destinationStream- output stream to receive the file contentsfilePath- absolute file path on the printer ("E:SAMPLE.TXT")ftpPassword- password used to login to FTP, if null, a default password ("1234") will be used.- Throws:
ConnectionException- if there is an error communicating with the printer, or the ftpPassword is invalidZebraIllegalArgumentException- if the filePath is invalid, or if the file does not exist on the printer.
-
getPrinterDownloadableObjectFromPrinter
byte[] getPrinterDownloadableObjectFromPrinter(String filePath) throws ConnectionException, ZebraIllegalArgumentException Retrieves a file from the printer's file system and returns the contents of that file as a byte array including all necessary file wrappers for redownloading to a Zebra printer. Will retrieve the following file extensions: ZPL, GRF, DAT, BAS, FMT, PNG, LBL, PCX, BMP, WML, CSV, HTM, TXT
Files transferred between different printer models may not be compatible.- Parameters:
filePath- absolute file path on the printer ("E:SAMPLE.TXT")- Returns:
- A Zebra printer downloadable file content.
- Throws:
ConnectionException- if there is an issue communicating with the device (e.g. the connection is not open).ZebraIllegalArgumentException- if the filePath is invalid, or if the file does not exist on the printer.
-