Class PathBody

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String fileName  
      private java.nio.file.Path path  
    • Constructor Summary

      Constructors 
      Constructor Description
      PathBody​(java.nio.file.Path path)
      Constructs a new instance for a given Path.
      PathBody​(java.nio.file.Path path, org.apache.hc.core5.http.ContentType contentType)
      Constructs a new instance for a given Path.
      PathBody​(java.nio.file.Path path, org.apache.hc.core5.http.ContentType contentType, java.lang.String fileName)
      Constructs a new instance for a given Path.
    • Field Detail

      • fileName

        private final java.lang.String fileName
      • path

        private final java.nio.file.Path path
    • Constructor Detail

      • PathBody

        public PathBody​(java.nio.file.Path path)
        Constructs a new instance for a given Path.
        Parameters:
        path - the source Path.
      • PathBody

        public PathBody​(java.nio.file.Path path,
                        org.apache.hc.core5.http.ContentType contentType)
        Constructs a new instance for a given Path.
        Parameters:
        path - the source Path.
        contentType - the content type.
      • PathBody

        public PathBody​(java.nio.file.Path path,
                        org.apache.hc.core5.http.ContentType contentType,
                        java.lang.String fileName)
        Constructs a new instance for a given Path.
        Parameters:
        path - the source Path.
        contentType - the content type.
        fileName - The file name to override the Path's file name.
    • Method Detail

      • getFileName

        private static java.lang.String getFileName​(java.nio.file.Path path)
      • getContentLength

        public long getContentLength()
        Description copied from interface: ContentDescriptor
        Returns the body descriptors content-length.
        Returns:
        Content length, if known, or -1, to indicate the absence of a content-length header.
      • getFilename

        public java.lang.String getFilename()
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Gets a new input stream.
        Returns:
        a new input stream.
        Throws:
        java.io.IOException - if an I/O error occurs
      • getPath

        public java.nio.file.Path getPath()
        Gets the source Path.
        Returns:
        the source Path.
      • writeTo

        public void writeTo​(java.io.OutputStream out)
                     throws java.io.IOException
        Throws:
        java.io.IOException