Package org.cip4.lib.xjdf
Class ZipPackage
- java.lang.Object
-
- org.cip4.lib.xjdf.ZipPackage
-
public class ZipPackage extends java.lang.ObjectThis class provides functionality all about packaging.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classZipPackage.BuilderZipPackage builder class.
-
Constructor Summary
Constructors Constructor Description ZipPackage()Default constructor.ZipPackage(byte[] zipArchive)Custom constructor.ZipPackage(XJmfMessage rootJmf)Custom constructor.ZipPackage(XJmfMessage rootJmf, @NotNull java.util.Map<URI,XJdfDocument> xJdfDocuments)Custom constructor.ZipPackage(XJmfMessage rootJmf, @NotNull java.util.Map<URI,XJdfDocument> xJdfDocuments, @NotNull java.util.Map<URI,byte[]> files)Custom constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getFile(java.lang.String uri)Returns a file as byte array.byte[]getFile(URI uri)Returns a file as byte array.XJdfDocumentgetXJdfDocument(java.lang.String uri)Returns an XJDF Document by uri.XJdfDocumentgetXJdfDocument(URI uri)Returns an XJDF Document by uri.XJmfMessagegetXJmfRoot()Returns the XJMF Root Message in the package.java.util.Set<URI>listFiles()Returns list of all files.byte[]packageFiles()Packages files to a zip archive.
-
-
-
Constructor Detail
-
ZipPackage
public ZipPackage()
Default constructor.
-
ZipPackage
public ZipPackage(XJmfMessage rootJmf) throws XJdfValidationException, XJdfParseException
Custom constructor.
Accepting a root XJMF and a map of XJDF Documents for initializing.- Parameters:
rootJmf- The root xjmf message.- Throws:
XJdfValidationExceptionXJdfParseException
-
ZipPackage
public ZipPackage(XJmfMessage rootJmf, @NotNull @NotNull java.util.Map<URI,XJdfDocument> xJdfDocuments) throws XJdfValidationException, XJdfParseException
Custom constructor.
Accepting a root XJMF and a map of XJDF Documents for initializing.- Parameters:
rootJmf- The root xjmf message.xJdfDocuments- Map of XJDF Documents- Throws:
XJdfValidationExceptionXJdfParseException
-
ZipPackage
public ZipPackage(XJmfMessage rootJmf, @NotNull @NotNull java.util.Map<URI,XJdfDocument> xJdfDocuments, @NotNull @NotNull java.util.Map<URI,byte[]> files) throws XJdfValidationException, XJdfParseException
Custom constructor.
Accepting a root XJMF and a map of XJDF Documents for initializing.- Parameters:
rootJmf- The root xjmf message.xJdfDocuments- Map of XJDF Documentsfiles- Map of files- Throws:
XJdfValidationExceptionXJdfParseException
-
ZipPackage
public ZipPackage(byte[] zipArchive) throws java.io.IOException, java.net.URISyntaxExceptionCustom constructor.
Accepting a zip archive for initializing.- Throws:
java.io.IOExceptionjava.net.URISyntaxException
-
-
Method Detail
-
listFiles
public java.util.Set<URI> listFiles()
Returns list of all files.- Returns:
- Set of file URIs.
-
getFile
public byte[] getFile(java.lang.String uri) throws java.net.URISyntaxExceptionReturns a file as byte array.- Parameters:
uri- The uri as string.- Returns:
- The file as byte array.
- Throws:
java.net.URISyntaxException
-
getFile
public byte[] getFile(URI uri)
Returns a file as byte array.- Parameters:
uri- The uri object.- Returns:
- The file as byte array.
-
getXJdfDocument
public XJdfDocument getXJdfDocument(java.lang.String uri) throws XJdfInitException, XJdfParseException, java.net.URISyntaxException
Returns an XJDF Document by uri.- Parameters:
uri- The uri object.- Returns:
- The XJDF Document.
- Throws:
XJdfInitExceptionXJdfParseExceptionjava.net.URISyntaxException
-
getXJdfDocument
public XJdfDocument getXJdfDocument(URI uri) throws XJdfInitException, XJdfParseException
Returns an XJDF Document by uri.- Parameters:
uri- The uri object.- Returns:
- The XJDF Document.
- Throws:
XJdfInitExceptionXJdfParseException
-
getXJmfRoot
public XJmfMessage getXJmfRoot() throws XJdfInitException, XJdfParseException
Returns the XJMF Root Message in the package.- Returns:
- The XJMF root message.
- Throws:
XJdfInitExceptionXJdfParseException
-
packageFiles
public byte[] packageFiles() throws java.io.IOExceptionPackages files to a zip archive.- Returns:
- The zip packaged files as byte array.
- Throws:
java.io.IOException
-
-