Java Code Examples for org.apache.wicket.util.io.IOUtils#copy()
The following examples show how to use
org.apache.wicket.util.io.IOUtils#copy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CssConcatResourceBundleReference.java From onedev with MIT License | 5 votes |
@Override public IResource getResource() { ConcatBundleResource bundleResource = new ConcatBundleResource(getProvidedResources()) { @Override protected byte[] readAllResources(List<IResourceStream> resources) throws IOException, ResourceStreamNotFoundException { ByteArrayOutputStream output = new ByteArrayOutputStream(); for (IResourceStream curStream : resources) { IOUtils.copy(curStream.getInputStream(), output); output.write("\n".getBytes()); } byte[] bytes = output.toByteArray(); if (getCompressor() != null) { String nonCompressed = new String(bytes, "UTF-8"); bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8"); } return bytes; } }; ITextResourceCompressor compressor = getCompressor(); if (compressor != null) { bundleResource.setCompressor(compressor); } return bundleResource; }
Example 2
Source File: JavaScriptConcatResourceBundleReference.java From onedev with MIT License | 5 votes |
@Override public IResource getResource() { ConcatBundleResource bundleResource = new ConcatBundleResource(getProvidedResources()) { @Override protected byte[] readAllResources(List<IResourceStream> resources) throws IOException, ResourceStreamNotFoundException { ByteArrayOutputStream output = new ByteArrayOutputStream(); for (IResourceStream curStream : resources) { IOUtils.copy(curStream.getInputStream(), output); output.write(";\n".getBytes()); } byte[] bytes = output.toByteArray(); if (getCompressor() != null) { String nonCompressed = new String(bytes, "UTF-8"); bytes = getCompressor().compress(nonCompressed).getBytes("UTF-8"); } return bytes; } }; ITextResourceCompressor compressor = getCompressor(); if (compressor != null) { bundleResource.setCompressor(compressor); } return bundleResource; }
Example 3
Source File: OrienteerClassLoaderUtil.java From Orienteer with Apache License 2.0 | 5 votes |
/** * Download Orienteer artifacts from server. * @return list of {@link OArtifact} from server * @throws IOException */ public static List<OArtifact> getOrienteerArtifactsFromServer() throws IOException { URL website = new URL(initUtils.getOrienteerModulesUrl()); File localFile = new File(initUtils.getPathToModulesFolder().toFile(), "modules.xml"); FileOutputStream fos = new FileOutputStream(localFile); try { IOUtils.copy(website.openStream(), fos); } finally { fos.close(); } OrienteerArtifactsReader reader = new OrienteerArtifactsReader(localFile.toPath()); List<OArtifact> ooArtifacts = reader.readArtifacts(); List<OArtifact> metadataModules = getOArtifactsMetadataAsList(); for (OArtifact metadataModule : metadataModules) { for (OArtifact module : ooArtifacts) { OArtifactReference metadataArtifact = metadataModule.getArtifactReference(); OArtifactReference moduleArtifact = module.getArtifactReference(); if (metadataArtifact.getGroupId().equals(moduleArtifact.getGroupId()) && metadataArtifact.getArtifactId().equals(moduleArtifact.getArtifactId())) { module.setDownloaded(true); } } } addAvailableVersions(ooArtifacts); return ooArtifacts; }