private void putBlob(Blob blob, OutputStream stdout) throws IOException { byte[] buf = new byte[1024]; try (InputStream in = blob.open()) { while (true) { int read = in.read(buf); if (read < 0) { break; } stdout.write(buf, 0, read); } } }
private static String resolve(String extension, Blob blob, TemporaryFiles temporaries) throws IOException { if (blob instanceof FileBlob) { return ((FileBlob) blob).getFile().getAbsolutePath(); } String suffix = BlobUtil.getSuffix(extension, blob); try (InputStream in = blob.open()) { return temporaries.create(BLOB_FILE_PREFIX, suffix, in).getAbsolutePath(); } }