Package com.teamdev.jxbrowser.net
Class File.Builder
java.lang.Object
com.teamdev.jxbrowser.net.File.Builder
- Enclosing interface:
- File
A builder of
File.
Builders are created by invoking File.newBuilder().
Each of the setter methods modifies the state of the builder and returns the same instance.
Builders are not thread-safe and should not be used concurrently from multiple threads
without external synchronization.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a newFileinstance built from the current state of this builder.bytesValue(byte[] bytes) Sets the file content.contentType(String contentType) Sets the file content type.Sets the file name.Sets the file path.
-
Method Details
-
name
Sets the file name.- Parameters:
name- the file name- Returns:
- this builder
-
contentType
Sets the file content type.Please note, when the file value is specified using a
path, the content type may be omitted. In such cases, Chromium will automatically determine the content type based on the file extension. If no MIME type is associated with the extension, the content type defaults toapplication/octet-stream.For files provided as
byte arrays, the content type is always passed as-is. It will not be determined automatically if it is empty.- Parameters:
contentType- the file content type determined by the file extension- Returns:
- this builder
-
pathValue
Sets the file path.- Parameters:
path- the file path- Returns:
- this builder
-
bytesValue
Sets the file content.- Parameters:
bytes- the file content- Returns:
- this builder
-
build
Returns a newFileinstance built from the current state of this builder.- Returns:
- a new
Fileinstance
-