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
NuxeoArchiveWriter
or 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 byNuxeoArchiveWriter
and has a special format (TODO DOCUMENT), or it holds aZipFile
that may be used in a random-access manner.
-
-
Constructor Summary
Constructors Modifier Constructor Description NuxeoArchiveReader(File file)
Create aNuxeoArchiveReader
from aFile
.NuxeoArchiveReader(InputStream in)
Create aNuxeoArchiveReader
from anInputStream
.protected
NuxeoArchiveReader(ZipInputStream in, boolean checkMarker)
Protected constructor used byZipReader
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildOrderedZipIndex()
void
close()
Closes the reader.protected void
fillExportedDocument(ExportedDocument xdoc, ZipEntry entry)
static boolean
isMarkerEntry(ZipEntry entry)
ExportedDocument
read()
Reads a single document.protected ExportedDocument
readOrderedStream()
protected ExportedDocument
readZip()
-
Methods inherited from class org.nuxeo.ecm.core.io.impl.AbstractDocumentReader
read
-
-
-
-
Constructor Detail
-
NuxeoArchiveReader
public NuxeoArchiveReader(InputStream in) throws IOException
Create aNuxeoArchiveReader
from 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 aNuxeoArchiveReader
from 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:DocumentReader
Reads a single document.- Specified by:
read
in interfaceDocumentReader
- Specified by:
read
in 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:DocumentReader
Closes the reader.
-
isMarkerEntry
public static boolean isMarkerEntry(ZipEntry entry)
-
-