private byte[] doSignatureFile(String[] digestNames, MessageDigest[] algorithms, byte[] manbytes) throws IOException { try (ByteBufferOutputStream out = new ByteBufferOutputStream(); PrintWriter ps = IO.writer(out)) { ps.print("Signature-Version: 1.0\r\n"); for (int a = 0; a < algorithms.length; a++) { if (algorithms[a] != null) { byte[] digest = algorithms[a].digest(manbytes); ps.print(digestNames[a] + "-Digest-Manifest: "); ps.print(new Base64(digest)); ps.print("\r\n"); } } ps.flush(); return out.toByteArray(); } }
private byte[] doSignatureFile(String[] digestNames, MessageDigest[] algorithms, byte[] manbytes) throws IOException { try (ByteBufferOutputStream out = new ByteBufferOutputStream(); PrintWriter ps = IO.writer(out)) { ps.print("Signature-Version: 1.0\r\n"); for (int a = 0; a < algorithms.length; a++) { if (algorithms[a] != null) { byte[] digest = algorithms[a].digest(manbytes); ps.print(digestNames[a] + "-Digest-Manifest: "); ps.print(new Base64(digest)); ps.print("\r\n"); } } ps.flush(); return out.toByteArray(); } }
private ByteBuffer getBuffer() throws Exception { if (buffer != null) { return buffer; } ByteBufferOutputStream out = new ByteBufferOutputStream(); write(out); return buffer = out.toByteBuffer(); }
private ByteBuffer getBuffer() throws Exception { if (buffer != null) { return buffer; } ByteBufferOutputStream out = new ByteBufferOutputStream(); write(out); return buffer = out.toByteBuffer(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
private Jar buildFromInputStream(InputStream in, long lastModified) throws IOException { try (ZipInputStream jin = new ZipInputStream(in)) { for (ZipEntry entry; (entry = jin.getNextEntry()) != null;) { if (entry.isDirectory()) { continue; } int size = (int) entry.getSize(); try (ByteBufferOutputStream bbos = new ByteBufferOutputStream((size == -1) ? BUFFER_SIZE : size + 1)) { bbos.write(jin); putResource(entry.getName(), new EmbeddedResource(bbos.toByteBuffer(), lastModified), true); } } } return this; }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
private Jar buildFromInputStream(InputStream in, long lastModified) throws IOException { try (ZipInputStream jin = new ZipInputStream(in)) { for (ZipEntry entry; (entry = jin.getNextEntry()) != null;) { if (entry.isDirectory()) { continue; } int size = (int) entry.getSize(); try (ByteBufferOutputStream bbos = new ByteBufferOutputStream((size == -1) ? BUFFER_SIZE : size + 1)) { bbos.write(jin); putResource(entry.getName(), new EmbeddedResource(bbos.toByteBuffer(), lastModified), true); } } } return this; }
private static InputStream processEntities(InputStream in) throws IOException { ByteBuffer bb = IO.copy(in, new ByteBufferOutputStream(in.available() + 1)) .toByteBuffer(); return processEntities(bb); }
public static byte[] read(InputStream in) throws IOException { return copy(in, new ByteBufferOutputStream()).toByteArray(); }
private static InputStream processEntities(InputStream in) throws IOException { ByteBuffer bb = IO.copy(in, new ByteBufferOutputStream(in.available() + 1)) .toByteBuffer(); return processEntities(bb); }
try (ByteBufferOutputStream o = new ByteBufferOutputStream()) { Manifest manifest = jar.getManifest(); manifest.getMainAttributes() try (ByteBufferOutputStream tmpStream = new ByteBufferOutputStream()) { jar.putResource("META-INF/BND.RSA", new EmbeddedResource(tmpStream.toByteArray(), 0L));
try (ByteBufferOutputStream o = new ByteBufferOutputStream()) { Manifest manifest = jar.getManifest(); manifest.getMainAttributes() try (ByteBufferOutputStream tmpStream = new ByteBufferOutputStream()) { jar.putResource("META-INF/BND.RSA", new EmbeddedResource(tmpStream.toByteArray(), 0L));
@Override protected byte[] getBytes() throws Exception { try (ByteBufferOutputStream bout = new ByteBufferOutputStream(); PrintWriter pw = IO.writer(bout, Constants.DEFAULT_CHARSET)) { ByteBuffer bb = resource.buffer();
@Override protected byte[] getBytes() throws Exception { try (ByteBufferOutputStream bout = new ByteBufferOutputStream(); PrintWriter pw = IO.writer(bout, Constants.DEFAULT_CHARSET)) { ByteBuffer bb = resource.buffer();
.replace(".bndrun", "")); ByteBufferOutputStream bout = new ByteBufferOutputStream(); manifest.write(bout); jar.putResource(ContainerType.SUBSYSTEM.getManifestURI(), new EmbeddedResource(bout.toByteBuffer(), 0));