本文整理了Java中com.xmlcalabash.extensions.Zip
类的一些代码示例,展示了Zip
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zip
类的具体详情如下:
包路径:com.xmlcalabash.extensions.Zip
类名称:Zip
暂无
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
private void update(ZipInputStream inZip, final ZipOutputStream outZip) {
String command = getOption(_command).getString();
if ("create".equals(command)) {
try {
if (inZip != null) {
inZip.close();
}
} catch (IOException ioe) {
throw new XProcException(ioe);
}
inZip = null;
}
if ("update".equals(command) || "create".equals(command)) {
update(inZip, outZip, false);
} else if ("freshen".equals(command)) {
update(inZip, outZip, true);
} else if ("delete".equals(command)) {
delete(inZip, outZip);
} else {
throw new XProcException(step.getNode(), "Unexpected cx:zip command: " + command);
}
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
private void readStream(TreeWriter tree, URI id, InputStream stream, final DatatypeFactory dfactory)
throws IOException {
ZipInputStream zipStream = new ZipInputStream(stream);
try {
ZipEntry entry = zipStream.getNextEntry();
while (entry != null) {
processEntry(tree, entry, dfactory);
}
} finally {
zipStream.close();
}
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
protected void store(FileToZip file, XdmNode doc, OutputStream out) throws SaxonApiException, IOException {
XdmNode root = S9apiUtils.getDocumentElement(doc);
if (((XProcConstants.NS_XPROC_STEP.equals(root.getNodeName().getNamespaceURI())
&& "base64".equals(root.getAttributeValue(_encoding)))
|| ("".equals(root.getNodeName().getNamespaceURI())
&& "base64".equals(root.getAttributeValue(c_encoding))))) {
storeBinary(file, doc, out);
} else if (XProcConstants.c_result.equals(root.getNodeName())
&& root.getAttributeValue(_content_type) != null
&& root.getAttributeValue(_content_type).startsWith("text/")) {
storeText(file, doc, out);
} else if (runtime.transparentJSON()
&& (((c_body.equals(root.getNodeName())
&& ("application/json".equals(root.getAttributeValue(_content_type))
|| "text/json".equals(root.getAttributeValue(_content_type))))
|| c_json.equals(root.getNodeName()))
|| JSONtoXML.JSONX_NS.equals(root.getNodeName().getNamespaceURI())
|| JSONtoXML.JXML_NS.equals(root.getNodeName().getNamespaceURI())
|| JSONtoXML.MLJS_NS.equals(root.getNodeName().getNamespaceURI()))) {
storeJSON(file, doc, out);
} else {
storeXML(file, doc, out);
}
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
public void run() throws SaxonApiException {
super.run();
final String zipFn = getOption(_href).getString();
parseManifest(man);
final String base = getOption(_href).getBaseURI().toASCIIString();
final DataStore store = runtime.getDataStore();
store.writeEntry(zipFn, base, "application/zip", new DataStore.DataWriter() {
代码示例来源:origin: com.xmlcalabash/xmlcalabash
public void storeXML(FileToZip file, XdmNode doc, OutputStream out) throws SaxonApiException {
Serializer serializer = makeSerializer(file.getOptions());
serializer.setOutputStream(out);
S9apiUtils.serialize(runtime, doc, serializer);
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
if (srcManifest.containsKey(uri.toString())) {
XdmNode doc = srcManifest.get(href);
store(file, doc, baos);
} else {
DataStore store = runtime.getDataStore();
store(file, doc, outZip);
} else {
DataStore store = runtime.getDataStore();
代码示例来源:origin: com.xmlcalabash/xmlcalabash
protected void store(FileToZip file, XdmNode doc, OutputStream out) throws SaxonApiException, IOException {
XdmNode root = S9apiUtils.getDocumentElement(doc);
if (((XProcConstants.NS_XPROC_STEP.equals(root.getNodeName().getNamespaceURI())
&& "base64".equals(root.getAttributeValue(_encoding)))
|| ("".equals(root.getNodeName().getNamespaceURI())
&& "base64".equals(root.getAttributeValue(c_encoding))))) {
storeBinary(file, doc, out);
} else if (XProcConstants.c_result.equals(root.getNodeName())
&& root.getAttributeValue(_content_type) != null
&& root.getAttributeValue(_content_type).startsWith("text/")) {
storeText(file, doc, out);
} else if (runtime.transparentJSON()
&& (((c_body.equals(root.getNodeName())
&& ("application/json".equals(root.getAttributeValue(_content_type))
|| "text/json".equals(root.getAttributeValue(_content_type))))
|| c_json.equals(root.getNodeName()))
|| JSONtoXML.JSONX_NS.equals(root.getNodeName().getNamespaceURI())
|| JSONtoXML.JXML_NS.equals(root.getNodeName().getNamespaceURI())
|| JSONtoXML.MLJS_NS.equals(root.getNodeName().getNamespaceURI()))) {
storeJSON(file, doc, out);
} else {
storeXML(file, doc, out);
}
}
代码示例来源:origin: com.xmlcalabash/xmlcalabash
public void run() throws SaxonApiException {
super.run();
final String zipFn = getOption(_href).getString();
parseManifest(man);
final String base = getOption(_href).getBaseURI().toASCIIString();
final DataStore store = runtime.getDataStore();
store.writeEntry(zipFn, base, "application/zip", new DataStore.DataWriter() {
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
public void storeXML(FileToZip file, XdmNode doc, OutputStream out) throws SaxonApiException {
Serializer serializer = makeSerializer(file.getOptions());
serializer.setOutputStream(out);
S9apiUtils.serialize(runtime, doc, serializer);
}
代码示例来源:origin: com.xmlcalabash/xmlcalabash
if (srcManifest.containsKey(uri.toString())) {
XdmNode doc = srcManifest.get(href);
store(file, doc, baos);
} else {
DataStore store = runtime.getDataStore();
store(file, doc, outZip);
} else {
DataStore store = runtime.getDataStore();
代码示例来源:origin: com.xmlcalabash/xmlcalabash
private void update(ZipInputStream inZip, final ZipOutputStream outZip) {
String command = getOption(_command).getString();
if ("create".equals(command)) {
try {
if (inZip != null) {
inZip.close();
}
} catch (IOException ioe) {
throw new XProcException(ioe);
}
inZip = null;
}
if ("update".equals(command) || "create".equals(command)) {
update(inZip, outZip, false);
} else if ("freshen".equals(command)) {
update(inZip, outZip, true);
} else if ("delete".equals(command)) {
delete(inZip, outZip);
} else {
throw new XProcException(step.getNode(), "Unexpected cx:zip command: " + command);
}
}
代码示例来源:origin: com.xmlcalabash/xmlcalabash
private void readStream(TreeWriter tree, URI id, InputStream stream, final DatatypeFactory dfactory)
throws IOException {
ZipInputStream zipStream = new ZipInputStream(stream);
try {
ZipEntry entry = zipStream.getNextEntry();
while (entry != null) {
processEntry(tree, entry, dfactory);
}
} finally {
zipStream.close();
}
}
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
private void readFile(TreeWriter tree, URI id, String zipFn, final DatatypeFactory dfactory)
throws IOException {
ZipFile zipFile = null;
try {
File uriFile = new File(new URI(zipFn));
zipFile = new ZipFile(uriFile);
Enumeration<? extends ZipEntry> zipEntryEnum = zipFile.entries();
while (zipEntryEnum.hasMoreElements()) {
ZipEntry entry = zipEntryEnum.nextElement();
processEntry(tree, entry, dfactory);
}
} catch (URISyntaxException e) {
throw new XProcException(e);
} finally {
if (zipFile != null) {
zipFile.close();
}
}
}
代码示例来源:origin: com.xmlcalabash/xmlcalabash
private void readFile(TreeWriter tree, URI id, String zipFn, final DatatypeFactory dfactory)
throws IOException {
ZipFile zipFile = null;
try {
File uriFile = new File(new URI(zipFn));
zipFile = new ZipFile(uriFile);
Enumeration<? extends ZipEntry> zipEntryEnum = zipFile.entries();
while (zipEntryEnum.hasMoreElements()) {
ZipEntry entry = zipEntryEnum.nextElement();
processEntry(tree, entry, dfactory);
}
} catch (URISyntaxException e) {
throw new XProcException(e);
} finally {
if (zipFile != null) {
zipFile.close();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!