Class PathBody
java.lang.Object
org.apache.hc.client5.http.entity.mime.AbstractContentBody
org.apache.hc.client5.http.entity.mime.PathBody
- All Implemented Interfaces:
ContentBody, ContentDescriptor
Binary body part backed by an NIO
Path.- Since:
- 5.6
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance for a given Path.Constructs a new instance for a given Path.Constructs a new instance for a given Path. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the body descriptors content-length.private static StringgetFileName(Path path) Gets a new input stream.getPath()Gets the source Path.voidwriteTo(OutputStream out) Methods inherited from class AbstractContentBody
getCharset, getContentType, getMediaType, getMimeType, getSubType
-
Field Details
-
fileName
-
path
-
-
Constructor Details
-
PathBody
Constructs a new instance for a given Path.- Parameters:
path- the source Path.
-
PathBody
Constructs a new instance for a given Path.- Parameters:
path- the source Path.contentType- the content type.
-
PathBody
-
-
Method Details
-
getFileName
-
getContentLength
public long getContentLength()Description copied from interface:ContentDescriptorReturns the body descriptors content-length.- Returns:
- Content length, if known, or -1, to indicate the absence of a content-length header.
-
getFilename
-
getInputStream
Gets a new input stream.- Returns:
- a new input stream.
- Throws:
IOException- if an I/O error occurs
-
getPath
-
writeTo
- Throws:
IOException
-