public ProcessArchive(ZipInputStream zipInputStream) throws IOException { for (ZipEntry zipEntry = zipInputStream.getNextEntry(); zipEntry != null; zipEntry = zipInputStream.getNextEntry()) { String entryName = zipEntry.getName(); byte[] bytes = IoUtil.readBytes(zipInputStream); entries.put(entryName, bytes); } }
public static byte[] readBytes(InputStream in) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); transfer(in, out); return out.toByteArray(); }
public ProcessArchive(ZipInputStream zipInputStream) throws IOException { for (ZipEntry zipEntry = zipInputStream.getNextEntry(); zipEntry != null; zipEntry = zipInputStream.getNextEntry()) { String entryName = zipEntry.getName(); byte[] bytes = IoUtil.readBytes(zipInputStream); entries.put(entryName, bytes); } }
public static byte[] readBytes(InputStream in) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); transfer(in, out); return out.toByteArray(); }
private void storeFileInDb(String name, InputStream is) throws IOException { if (processFiles == null) { processFiles = new HashMap(); } log.trace("preparing '" + name + "' for storage in the database"); processFiles.put(name, new ByteArray(name, IoUtil.readBytes(is))); }
private void storeFileInFileSystem(String name, InputStream is) throws IOException { File filePath = getFilePath(name); log.trace("storing '" + name + "' to file '" + filePath + "'"); FileOutputStream fos = new FileOutputStream(filePath); IoUtil.transfer(is, fos); fos.close(); }
private void storeFileInDb(String name, InputStream is) throws IOException { if (processFiles == null) { processFiles = new HashMap(); } log.trace("preparing '" + name + "' for storage in the database"); processFiles.put(name, new ByteArray(name, IoUtil.readBytes(is))); }
private byte[] getBytesFromFileSystem(String name) { InputStream in = getInputStreamFromFileSystem(name); if (in == null) return null; try { return IoUtil.readBytes(in); } catch (IOException e) { return null; } finally { try { in.close(); } catch (IOException e) { // disregard exception on close } } }
private byte[] getBytesFromFileSystem(String name) { InputStream in = getInputStreamFromFileSystem(name); if (in == null) return null; try { return IoUtil.readBytes(in); } catch (IOException e) { return null; } finally { try { in.close(); } catch (IOException e) { // disregard exception on close } } }