Class NuxeoArchiveReader
- java.lang.Object
-
- org.nuxeo.ecm.core.io.impl.AbstractDocumentReader
-
- org.nuxeo.ecm.core.io.impl.plugins.NuxeoArchiveReader
-
- All Implemented Interfaces:
DocumentReader
public class NuxeoArchiveReader extends AbstractDocumentReader
Reads nuxeo archives generated usingNuxeoArchiveWriter.If you need to read a CoreIO XML Archive that was not directly generated by
NuxeoArchiveWriteror that was modified you need to use the NuxeoArchiveReader(File) constructor.This implementation holds either a
ZipInputStream, in which case it is assumed to have been generated byNuxeoArchiveWriterand has a special format (TODO DOCUMENT), or it holds aZipFilethat may be used in a random-access manner.
-
-
Constructor Summary
Constructors Modifier Constructor Description NuxeoArchiveReader(File file)Create aNuxeoArchiveReaderfrom aFile.NuxeoArchiveReader(InputStream in)Create aNuxeoArchiveReaderfrom anInputStream.protectedNuxeoArchiveReader(ZipInputStream in, boolean checkMarker)Protected constructor used byZipReader.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildOrderedZipIndex()voidclose()Closes the reader.protected voidfillExportedDocument(ExportedDocument xdoc, ZipEntry entry)static booleanisMarkerEntry(ZipEntry entry)ExportedDocumentread()Reads a single document.protected ExportedDocumentreadOrderedStream()protected ExportedDocumentreadZip()-
Methods inherited from class org.nuxeo.ecm.core.io.impl.AbstractDocumentReader
read
-
-
-
-
Constructor Detail
-
NuxeoArchiveReader
public NuxeoArchiveReader(InputStream in) throws IOException
Create aNuxeoArchiveReaderfrom anInputStream.The InputStream must point to an archive that was generated by
NuxeoArchiveWriter.- Parameters:
in- InputStream pointing an archive that was generated by NuxeoArchiveWriter- Throws:
IOException
-
NuxeoArchiveReader
protected NuxeoArchiveReader(ZipInputStream in, boolean checkMarker) throws IOException
Protected constructor used byZipReader. Must not close the stream when done.- Throws:
IOException
-
NuxeoArchiveReader
public NuxeoArchiveReader(File file) throws IOException
Create aNuxeoArchiveReaderfrom aFile.This constructor is different from others because it allows the input zip file to have been generated by an other engine that
NuxeoArchiveWriter.In particular, you can use this constructor on a Zip Archive that was manually modified.
- Parameters:
file- a Zip archive- Throws:
IOException
-
-
Method Detail
-
buildOrderedZipIndex
protected void buildOrderedZipIndex()
-
read
public ExportedDocument read() throws IOException
Description copied from interface:DocumentReaderReads a single document.- Specified by:
readin interfaceDocumentReader- Specified by:
readin classAbstractDocumentReader- Returns:
- the document read or null if there are no more documents to read
- Throws:
IOException
-
readZip
protected ExportedDocument readZip() throws IOException
- Throws:
IOException
-
readOrderedStream
protected ExportedDocument readOrderedStream() throws IOException
- Throws:
IOException
-
fillExportedDocument
protected void fillExportedDocument(ExportedDocument xdoc, ZipEntry entry) throws IOException
- Throws:
IOException
-
close
public void close()
Description copied from interface:DocumentReaderCloses the reader.
-
isMarkerEntry
public static boolean isMarkerEntry(ZipEntry entry)
-
-