|
|
|
@ -50,39 +50,41 @@ import net.yacy.kelondro.util.FileUtils;
|
|
|
|
|
|
|
|
|
|
public class odtParser extends AbstractParser implements Parser {
|
|
|
|
|
|
|
|
|
|
public final static int MAX_DOCSIZE = 200 * 1024 * 1024;
|
|
|
|
|
|
|
|
|
|
public odtParser() {
|
|
|
|
|
super("OASIS OpenDocument V2 Text Document Parser");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("odt");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("ods");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("odp");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("odg");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("odc");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("odf");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("odb");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("odi");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("odm");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("ott");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("ots");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("otp");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("otg");
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("sxw"); // Star Office Writer file format
|
|
|
|
|
SUPPORTED_EXTENSIONS.add("sxc"); // Star Office Calc file format
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.text");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.spreadsheet");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.presentation");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.graphics");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.chart");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.formula");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.database");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.image");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.text-master");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.text-template");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.spreadsheet-template");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.presentation-template");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.graphics-template");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/x-vnd.oasis.opendocument.text");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/OOo-calc");
|
|
|
|
|
SUPPORTED_MIME_TYPES.add("application/OOo-writer");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("odt");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("ods");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("odp");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("odg");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("odc");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("odf");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("odb");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("odi");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("odm");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("ott");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("ots");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("otp");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("otg");
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("sxw"); // Star Office Writer file format
|
|
|
|
|
this.SUPPORTED_EXTENSIONS.add("sxc"); // Star Office Calc file format
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.text");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.spreadsheet");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.presentation");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.graphics");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.chart");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.formula");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.database");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.image");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.text-master");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.text-template");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.spreadsheet-template");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.presentation-template");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/vnd.oasis.opendocument.graphics-template");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/x-vnd.oasis.opendocument.text");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/OOo-calc");
|
|
|
|
|
this.SUPPORTED_MIME_TYPES.add("application/OOo-writer");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Document[] parse(final MultiProtocolURI location, final String mimeType,
|
|
|
|
@ -114,7 +116,7 @@ public class odtParser extends AbstractParser implements Parser {
|
|
|
|
|
if (entryName.equals("content.xml")) {
|
|
|
|
|
|
|
|
|
|
// create a writer for output
|
|
|
|
|
writer = new CharBuffer((int)zipEntry.getSize());
|
|
|
|
|
writer = new CharBuffer(MAX_DOCSIZE, (int)zipEntry.getSize());
|
|
|
|
|
try {
|
|
|
|
|
// extract data
|
|
|
|
|
final InputStream zipFileEntryStream = zipFile.getInputStream(zipEntry);
|
|
|
|
@ -191,6 +193,7 @@ public class odtParser extends AbstractParser implements Parser {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Document[] parse(final MultiProtocolURI location, final String mimeType, final String charset, final InputStream source) throws Parser.Failure, InterruptedException {
|
|
|
|
|
File dest = null;
|
|
|
|
|
try {
|
|
|
|
|