public static FilePayload newFilePayload(File data) { return new FilePayload(checkNotNull(data, "data")); }
public Resource(FilePayload payload) { this(payload.getRawContent().getName(), null, payload.getContentMetadata().getContentMD5(), payload .getRawContent().getPath(), "default"); }
public FilePayload(File content) { super(content); getContentMetadata().setContentLength(content.length()); checkArgument(checkNotNull(content, "content").exists(), "file must exist: " + content); }
public static Part.PartMap create(String name, Payload delegate, Part.PartOptions options) { String filename = options != null ? options.getFilename() : null; if (delegate instanceof FilePayload) filename = FilePayload.class.cast(delegate).getRawContent().getName(); Part.PartMap returnVal; returnVal = (filename != null) ? create(name, filename) : create(name); if (options != null) returnVal.contentType(options.getContentType()); return returnVal; } }
public void testWritePayloadOnFile_SourceFileDoesntExist() { File sourceFile = new File("asdfkjsadkfjasdlfasdflk.asdfasdfas"); FilePayload payload = new FilePayload(sourceFile); try { payload.getInput(); fail("Exception not thrown"); } catch (Exception ex) { assertNotNull(Throwables2.getFirstThrowableOfType(ex, IOException.class)); } }
public FilePayload(File content) { super(content); getContentMetadata().setContentLength(content.length()); checkNotNull(content, "content"); }
public static Part.PartMap create(String name, Payload delegate, Part.PartOptions options) { String filename = options != null ? options.getFilename() : null; if (delegate instanceof FilePayload) filename = FilePayload.class.cast(delegate).getRawContent().getName(); Part.PartMap returnVal; returnVal = (filename != null) ? create(name, filename) : create(name); if (options != null) returnVal.contentType(options.getContentType()); return returnVal; } }
public Resource(FilePayload payload) { this(payload.getRawContent().getName(), null, payload.getContentMetadata().getContentMD5(), payload .getRawContent().getPath(), "default"); }
public static FilePayload newFilePayload(File data) { return new FilePayload(checkNotNull(data, "data")); }
public FilePayload(File content) { super(content); getContentMetadata().setContentLength(content.length()); checkArgument(checkNotNull(content, "content").exists(), "file must exist: " + content); }
public static Part.PartMap create(String name, Payload delegate, Part.PartOptions options) { String filename = options != null ? options.getFilename() : null; if (delegate instanceof FilePayload) filename = FilePayload.class.cast(delegate).getRawContent().getName(); Part.PartMap returnVal; returnVal = (filename != null) ? create(name, filename) : create(name); if (options != null) returnVal.contentType(options.getContentType()); return returnVal; } }
public Builder fromPayload(FilePayload payload) { checkNotNull(payload, "payload"); this.name(payload.getRawContent().getName()); this.checksum(payload.getContentMetadata().getContentMD5()); this.path(payload.getRawContent().getPath()); return this; }
public static FilePayload newFilePayload(File data) { return new FilePayload(checkNotNull(data, "data")); }
public FilePayload(File content) { super(content); getContentMetadata().setContentLength(content.length()); checkNotNull(content, "content"); }
public static Part.PartMap create(String name, Payload delegate, Part.PartOptions options) { String filename = options != null ? options.getFilename() : null; if (delegate instanceof FilePayload) filename = FilePayload.class.cast(delegate).getRawContent().getName(); Part.PartMap returnVal; returnVal = (filename != null) ? create(name, filename) : create(name); if (options != null) returnVal.contentType(options.getContentType()); return returnVal; } }
public Builder fromPayload(FilePayload payload) { checkNotNull(payload, "payload"); this.name(payload.getRawContent().getName()); this.checksum(payload.getContentMetadata().getContentMD5()); this.path(payload.getRawContent().getPath()); return this; }
public static FilePayload newFilePayload(File data) { return new FilePayload(checkNotNull(data, "data")); }
public FilePayload(File content) { super(content); getContentMetadata().setContentLength(content.length()); checkNotNull(content, "content"); }
public static Part.PartMap create(String name, Payload delegate, Part.PartOptions options) { String filename = options != null ? options.getFilename() : null; if (delegate instanceof FilePayload) filename = FilePayload.class.cast(delegate).getRawContent().getName(); Part.PartMap returnVal; returnVal = (filename != null) ? create(name, filename) : create(name); if (options != null) returnVal.contentType(options.getContentType()); return returnVal; } }
/** * @deprecated see newPayload(ByteSource) */ @Deprecated public static FilePayload newFilePayload(File data) { return new FilePayload(checkNotNull(data, "data")); }