Class PDComplexFileSpecification
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification
-
- org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification
-
- All Implemented Interfaces:
COSObjectable
public class PDComplexFileSpecification extends PDFileSpecification
This represents a file specification.- Author:
- Ben Litchfield
-
-
Constructor Summary
Constructors Constructor Description PDComplexFileSpecification()Default Constructor.PDComplexFileSpecification(COSDictionary dict)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description COSDictionarygetCOSObject()Convert this standard java object to a COS object.PDEmbeddedFilegetEmbeddedFile()Get the embedded file.PDEmbeddedFilegetEmbeddedFileDos()Get the embedded dos file.PDEmbeddedFilegetEmbeddedFileMac()Get the embedded Mac file.PDEmbeddedFilegetEmbeddedFileUnicode()Get the embedded unicode file.PDEmbeddedFilegetEmbeddedFileUnix()Get the embedded Unix file.java.lang.StringgetFile()This will get the file name.java.lang.StringgetFileDescription()This will get the description.java.lang.StringgetFileDos()This will get the name representing a Dos file.java.lang.StringgetFileMac()This will get the name representing a Mac file.java.lang.StringgetFilename()Preferred method for getting the filename.java.lang.StringgetFileUnicode()This will get the unicode file name.java.lang.StringgetFileUnix()This will get the name representing a Unix file.booleanisVolatile()Get if the file is volatile.voidsetEmbeddedFile(PDEmbeddedFile file)Set the embedded file for this spec.voidsetEmbeddedFileDos(PDEmbeddedFile file)Deprecated.This method is obsolescent and should not be used by conforming writers.voidsetEmbeddedFileMac(PDEmbeddedFile file)Deprecated.This method is obsolescent and should not be used by conforming writers.voidsetEmbeddedFileUnicode(PDEmbeddedFile file)Set the embedded Unicode file for this spec.voidsetEmbeddedFileUnix(PDEmbeddedFile file)Deprecated.This method is obsolescent and should not be used by conforming writers.voidsetFile(java.lang.String file)This will set the file name.voidsetFileDescription(java.lang.String description)Set the file description.voidsetFileDos(java.lang.String file)Deprecated.This method is obsolescent and should not be used by conforming writers.voidsetFileMac(java.lang.String file)Deprecated.This method is obsolescent and should not be used by conforming writers.voidsetFileUnicode(java.lang.String file)This will set the unicode file name.voidsetFileUnix(java.lang.String file)Deprecated.This method is obsolescent and should not be used by conforming writers.voidsetVolatile(boolean fileIsVolatile)Tell if the underlying file is volatile and should not be cached by the reader application.-
Methods inherited from class org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification
createFS
-
-
-
-
Constructor Detail
-
PDComplexFileSpecification
public PDComplexFileSpecification()
Default Constructor.
-
PDComplexFileSpecification
public PDComplexFileSpecification(COSDictionary dict)
Constructor. Creates empty COSDictionary if dict is null.- Parameters:
dict- The dictionary that fulfils this file specification.
-
-
Method Detail
-
getCOSObject
public COSDictionary getCOSObject()
Convert this standard java object to a COS object.- Returns:
- The cos object that matches this Java object.
-
getFilename
public java.lang.String getFilename()
Preferred method for getting the filename. It will determinate the recommended file name.
First of all we try to get the unicode filename if it exists. If it doesn't exist we take a look at the DOS, MAC UNIX filenames. If no one exist the required F entry will be returned.
Be aware that the filename may contain a directory separator and needs to be sanitized (CWE-22).
- Returns:
- The preferred file name.
-
getFileUnicode
public java.lang.String getFileUnicode()
This will get the unicode file name. Be aware that the filename may contain a directory separator and needs to be sanitized (CWE-22).- Returns:
- The file name.
-
setFileUnicode
public void setFileUnicode(java.lang.String file)
This will set the unicode file name. If you call this, then do not forget to also callsetFile(String)or the attachment will not be visible on some viewers.- Parameters:
file- The name of the file.
-
getFile
public java.lang.String getFile()
This will get the file name. Be aware that the filename may contain a directory separator and needs to be sanitized (CWE-22).- Specified by:
getFilein classPDFileSpecification- Returns:
- The file name.
-
setFile
public void setFile(java.lang.String file)
This will set the file name. You should also callsetFileUnicode(String)for cross-platform and cross-language compatibility.- Specified by:
setFilein classPDFileSpecification- Parameters:
file- The name of the file.
-
getFileDos
public java.lang.String getFileDos()
This will get the name representing a Dos file. Be aware that the filename may contain a directory separator and needs to be sanitized (CWE-22).- Returns:
- The file name.
-
setFileDos
@Deprecated public void setFileDos(java.lang.String file)
Deprecated.This method is obsolescent and should not be used by conforming writers.This will set name representing a dos file.- Parameters:
file- The name of the file.
-
getFileMac
public java.lang.String getFileMac()
This will get the name representing a Mac file. Be aware that the filename may contain a directory separator and needs to be sanitized (CWE-22).- Returns:
- The file name.
-
setFileMac
@Deprecated public void setFileMac(java.lang.String file)
Deprecated.This method is obsolescent and should not be used by conforming writers.This will set name representing a Mac file.- Parameters:
file- The name of the file.
-
getFileUnix
public java.lang.String getFileUnix()
This will get the name representing a Unix file. Be aware that the filename may contain a directory separator and needs to be sanitized (CWE-22).- Returns:
- The file name.
-
setFileUnix
@Deprecated public void setFileUnix(java.lang.String file)
Deprecated.This method is obsolescent and should not be used by conforming writers.This will set name representing a Unix file.- Parameters:
file- The name of the file.
-
setVolatile
public void setVolatile(boolean fileIsVolatile)
Tell if the underlying file is volatile and should not be cached by the reader application. Default: false- Parameters:
fileIsVolatile- The new value for the volatility of the file.
-
isVolatile
public boolean isVolatile()
Get if the file is volatile. Default: false- Returns:
- True if the file is volatile attribute is set.
-
getEmbeddedFile
public PDEmbeddedFile getEmbeddedFile()
Get the embedded file.- Returns:
- The embedded file for this file spec.
-
setEmbeddedFile
public void setEmbeddedFile(PDEmbeddedFile file)
Set the embedded file for this spec. You should also callsetEmbeddedFileUnicode(PDEmbeddedFile)for cross-platform and cross-language compatibility.- Parameters:
file- The file to be embedded.
-
getEmbeddedFileDos
public PDEmbeddedFile getEmbeddedFileDos()
Get the embedded dos file.- Returns:
- The embedded dos file for this file spec.
-
setEmbeddedFileDos
@Deprecated public void setEmbeddedFileDos(PDEmbeddedFile file)
Deprecated.This method is obsolescent and should not be used by conforming writers.Set the embedded dos file for this spec.- Parameters:
file- The dos file to be embedded.
-
getEmbeddedFileMac
public PDEmbeddedFile getEmbeddedFileMac()
Get the embedded Mac file.- Returns:
- The embedded Mac file for this file spec.
-
setEmbeddedFileMac
@Deprecated public void setEmbeddedFileMac(PDEmbeddedFile file)
Deprecated.This method is obsolescent and should not be used by conforming writers.Set the embedded Mac file for this spec.- Parameters:
file- The Mac file to be embedded.
-
getEmbeddedFileUnix
public PDEmbeddedFile getEmbeddedFileUnix()
Get the embedded Unix file.- Returns:
- The embedded file for this file spec.
-
setEmbeddedFileUnix
@Deprecated public void setEmbeddedFileUnix(PDEmbeddedFile file)
Deprecated.This method is obsolescent and should not be used by conforming writers.Set the embedded Unix file for this spec.- Parameters:
file- The Unix file to be embedded.
-
getEmbeddedFileUnicode
public PDEmbeddedFile getEmbeddedFileUnicode()
Get the embedded unicode file.- Returns:
- The embedded unicode file for this file spec.
-
setEmbeddedFileUnicode
public void setEmbeddedFileUnicode(PDEmbeddedFile file)
Set the embedded Unicode file for this spec. If you call this, then do not forget to also callsetEmbeddedFile(PDEmbeddedFile)or the attachment will not be visible on some viewers.- Parameters:
file- The Unicode file to be embedded.
-
setFileDescription
public void setFileDescription(java.lang.String description)
Set the file description.- Parameters:
description- The file description
-
getFileDescription
public java.lang.String getFileDescription()
This will get the description.- Returns:
- The file description.
-
-