@Override public void transferTo(OutputStream out) throws IOException { blob.transferTo(out); }
@Override public void transferTo(File file) throws IOException { blob.transferTo(file); }
protected File createTempSource(Blob blob, String ext) throws IOException { tmpFile = File.createTempFile("nuxeoImageSource", "." + ext); blob.transferTo(tmpFile); return tmpFile; }
protected void transferBlob(Blob blob, OutputStream entityStream) throws IOException { if (entityStream instanceof BufferingServletOutputStream) { ((BufferingServletOutputStream) entityStream).stopBuffering(); } blob.transferTo(entityStream); entityStream.flush(); }
protected void transferBlob(Blob blob, OutputStream entityStream) throws IOException { if (entityStream instanceof BufferingServletOutputStream) { ((BufferingServletOutputStream)entityStream).stopBuffering(); } blob.transferTo(entityStream); entityStream.flush(); }
protected File createTempSource(Blob blob, String ext) throws IOException { tmpFile = Framework.createTempFile("nuxeoImageSource", "." + ext); blob.transferTo(tmpFile); return tmpFile; }
protected void writeFile(Blob blob) throws IOException { String name = blob.getFilename(); if (name.length() == 0) { name = "blob#" + Integer.toHexString(System.identityHashCode(blob)); } // get the output file File file = getFile(name); // use a .tmp extension while writing the blob and rename it when write // is done this is allowing external tools to track when the file becomes // available. File tmp = new File(file.getParentFile(), file.getName() + ".tmp"); blob.transferTo(tmp); Files.move(tmp.toPath(), file.toPath()); }
@Override public String persist(String basePath) throws IOException { if (blobs == null || blobs.isEmpty()) { return null; } Path path = new Path(basePath); path = path.append(getHash()); if (blobs.size() == 1) { File file = new File(path.toString()); getBlob().transferTo(file); return file.getAbsolutePath(); } else { File dir = new File(path.toString()); dir.mkdir(); for (Blob blob : blobs) { File file = new File(path.append(blob.getFilename()).toString()); blob.transferTo(file); } return dir.getAbsolutePath(); } }
for (Map.Entry<String, Blob> entry : blobs.entrySet()) { String blobPath = file.getAbsolutePath() + File.separator + entry.getKey(); entry.getValue().transferTo(new File(blobPath));
public ImageInfoExtended getImageInfo(Blob blob) { ImageInfoExtended imageInfo = null; File tmpFile = null; try { File file = BlobHelper.getFileFromBlob(blob); if (file == null) { tmpFile = File.createTempFile("nuxeoImageInfo", blob.getFilename() != null ? "." + FilenameUtils.getExtension(blob.getFilename()) : ".tmp"); blob.transferTo(tmpFile); file = tmpFile; } imageInfo = getInfo(file.getAbsolutePath()); } catch (CommandNotAvailable | CommandException e) { log.error("Failed to get ImageInfo for file " + blob.getFilename(), e); } catch (IOException e) { log.error("Failed to transfer file " + blob.getFilename(), e); } finally { if (tmpFile != null) { tmpFile.delete(); } } return imageInfo; }
imageBlob.transferTo(imageFile);
((FileBlob) blob).moveTo(cachedFile); } else { blob.transferTo(cachedFile);
final Blob blob = blobParameters.get(blobParamName); final File file = File.createTempFile("cmdLineBasedConverter", "." + FilenameUtils.getExtension(blob.getFilename())); blob.transferTo(file); params.addNamedParameter(blobParamName, file); filesToDelete.add(file.getAbsolutePath());
content.transferTo(tmp); ZipFile zip = getArchiveFileIfValid(tmp);
file = Framework.createTempFile("nuxeoImage", ".jpg"); Framework.trackFile(file, this); blob.transferTo(file);
content.transferTo(tmp); ZipFile zip = getArchiveFileIfValid(tmp);