本文整理了Java中org.jboss.shrinkwrap.api.exporter.ZipExporter.exportAsInputStream()
方法的一些代码示例,展示了ZipExporter.exportAsInputStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipExporter.exportAsInputStream()
方法的具体详情如下:
包路径:org.jboss.shrinkwrap.api.exporter.ZipExporter
类名称:ZipExporter
方法名:exportAsInputStream
暂无
代码示例来源:origin: thorntail/thorntail
@Override
public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException {
return getEntry(mountPoint, target)
.map(e -> e.archive.as(ZipExporter.class).exportAsInputStream()).orElse(null);
}
代码示例来源:origin: io.thorntail/container
@Override
public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException {
return getEntry(mountPoint, target)
.map(e -> e.archive.as(ZipExporter.class).exportAsInputStream()).orElse(null);
}
代码示例来源:origin: org.wildfly.swarm/container
@Override
public InputStream openInputStream(VirtualFile mountPoint, VirtualFile target) throws IOException {
return getEntry(mountPoint, target)
.map(e -> e.archive.as(ZipExporter.class).exportAsInputStream()).orElse(null);
}
代码示例来源:origin: thorntail/thorntail
File getFile(Entry entry) {
if (entry.file == null) {
try {
entry.file = this.tempDir.createFile(entry.archive.getName(), entry.archive.as(ZipExporter.class).exportAsInputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
return entry.file;
}
代码示例来源:origin: org.wildfly.swarm/container
File getFile(Entry entry) {
if (entry.file == null) {
try {
entry.file = this.tempDir.createFile(entry.archive.getName(), entry.archive.as(ZipExporter.class).exportAsInputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
return entry.file;
}
代码示例来源:origin: io.thorntail/container
File getFile(Entry entry) {
if (entry.file == null) {
try {
entry.file = this.tempDir.createFile(entry.archive.getName(), entry.archive.as(ZipExporter.class).exportAsInputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
return entry.file;
}
代码示例来源:origin: org.arquillian.liferay/arquillian-processor-osgi-allin
private List<String> getAuxiliaryArchivesPackages(
Collection<Archive<?>> auxiliaryArchives)
throws IOException {
List<String> packages = new ArrayList<>();
for (Archive auxiliaryArchive : auxiliaryArchives) {
ZipExporter zipExporter = auxiliaryArchive.as(ZipExporter.class);
InputStream auxiliaryArchiveInputStream =
zipExporter.exportAsInputStream();
Jar jar = new Jar(
auxiliaryArchive.getName(), auxiliaryArchiveInputStream);
packages.addAll(jar.getPackages());
}
return packages;
}
代码示例来源:origin: thorntail/thorntail
public byte[] addContent(Archive<?> archive) throws IOException, URISyntaxException {
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
byte[] sha1Bytes;
messageDigest.reset();
BufferedInputStream bis = new BufferedInputStream(archive.as(ZipExporter.class).exportAsInputStream());
byte[] bytes = new byte[8192];
int read;
while ((read = bis.read(bytes)) > -1) {
messageDigest.update(bytes, 0, read);
}
sha1Bytes = messageDigest.digest();
String key = toKey(sha1Bytes);
this.fs.addArchive(archive.getName(), archive);
this.index.put(key, this.fsMount.getChild(archive.getName()).toURI());
return sha1Bytes;
} catch (NoSuchAlgorithmException e) {
throw new IOException(e);
}
}
代码示例来源:origin: io.thorntail/container
public byte[] addContent(Archive<?> archive) throws IOException, URISyntaxException {
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
byte[] sha1Bytes;
messageDigest.reset();
BufferedInputStream bis = new BufferedInputStream(archive.as(ZipExporter.class).exportAsInputStream());
byte[] bytes = new byte[8192];
int read;
while ((read = bis.read(bytes)) > -1) {
messageDigest.update(bytes, 0, read);
}
sha1Bytes = messageDigest.digest();
String key = toKey(sha1Bytes);
this.fs.addArchive(archive.getName(), archive);
this.index.put(key, this.fsMount.getChild(archive.getName()).toURI());
return sha1Bytes;
} catch (NoSuchAlgorithmException e) {
throw new IOException(e);
}
}
代码示例来源:origin: org.wildfly.swarm/tools
@Override
public InputStream openStream() {
return new WebInfLibFilteringArchive(this.asset.getArchive(), this.resolvedDependencies).as(ZipExporter.class).exportAsInputStream();
}
}
代码示例来源:origin: io.thorntail/tools
@Override
public InputStream openStream() {
return new WebInfLibFilteringArchive(this.asset.getArchive(), this.resolvedDependencies).as(ZipExporter.class).exportAsInputStream();
}
}
代码示例来源:origin: org.jboss.as/jboss-as-arquillian-common
private String deployInternal(Archive<?> archive) throws DeploymentException {
final InputStream input = archive.as(ZipExporter.class).exportAsInputStream();
try {
return deployInternal(archive.getName(), input);
} finally {
if (input != null)
try {
input.close();
} catch (IOException e) {
log.warnf(e, "Failed to close resource %s", input);
}
}
}
代码示例来源:origin: org.jboss.arquillian.container/arquillian-container-osgi
private VirtualFile toVirtualFile(Archive<?> archive) throws IOException {
ZipExporter exporter = archive.as(ZipExporter.class);
return AbstractVFS.toVirtualFile(archive.getName(), exporter.exportAsInputStream());
}
代码示例来源:origin: org.wildfly/wildfly-arquillian-common
private String deployInternal(Archive<?> archive) throws DeploymentException {
final InputStream input = archive.as(ZipExporter.class).exportAsInputStream();
try {
return deployInternal(archive.getName(), input);
} finally {
if (input != null)
try {
input.close();
} catch (IOException e) {
log.warnf(e, "Failed to close resource %s", input);
}
}
}
代码示例来源:origin: wildfly/wildfly-core
public void deploy(final Archive<?> archive, final String runtimeName) throws ServerDeploymentHelper.ServerDeploymentException {
getDeploymentHelper().deploy(runtimeName, archive.as(ZipExporter.class).exportAsInputStream());
}
代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm
@Override
public InputStream openStream() {
return filter(ShrinkWrap.create(ZipImporter.class)
.importFrom(this.delegate.openStream())
.as(JavaArchive.class))
.as(ZipExporter.class)
.exportAsInputStream();
}
代码示例来源:origin: org.wildfly.arquillian/wildfly-arquillian-common
private String deployInternal(Archive<?> archive) throws DeploymentException {
checkState();
final InputStream input = archive.as(ZipExporter.class).exportAsInputStream();
try {
return deployInternal(archive.getName(), input);
} finally {
if (input != null)
try {
input.close();
} catch (IOException e) {
log.warnf(e, "Failed to close resource %s", input);
}
}
}
代码示例来源:origin: wildfly/wildfly-arquillian
private String deployInternal(Archive<?> archive) throws DeploymentException {
checkState();
final InputStream input = archive.as(ZipExporter.class).exportAsInputStream();
try {
return deployInternal(archive.getName(), input);
} finally {
if (input != null)
try {
input.close();
} catch (IOException e) {
log.warnf(e, "Failed to close resource %s", input);
}
}
}
代码示例来源:origin: shrinkwrap/shrinkwrap
/**
* Test to ensure that the {@link ZipExporter} does not accept an empty archive as input
*
* SHRINKWRAP-93
*
* @throws Exception
*/
@Test(expected = IllegalArgumentException.class)
public void exportEmptyArchiveAsZip() throws Exception {
// Attempt to export an empty archive, should fail
ShrinkWrap.create(JavaArchive.class, NAME_ARCHIVE).as(ZipExporter.class).exportAsInputStream();
}
代码示例来源:origin: arquillian/arquillian-core
@Override
public InputStream getDeployment(String name) {
DeploymentScenario scenario = deploymentScenario.get();
if (scenario == null) {
throw new IllegalArgumentException("No deployment scenario in context");
}
Deployment deployment = scenario.deployment(new DeploymentTargetDescription(name));
if (deployment == null) {
throw new IllegalArgumentException("No deployment in context found with name " + name);
}
DeploymentDescription description = deployment.getDescription();
if (description.isArchiveDeployment()) {
Archive<?> archive = description.testable() ? description.getTestableArchive() : description.getArchive();
return archive.as(ZipExporter.class).exportAsInputStream();
} else {
return new ByteArrayInputStream(description.getDescriptor().exportAsString().getBytes());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!