Class PartImpl

java.lang.Object
io.undertow.servlet.spec.PartImpl
All Implemented Interfaces:
Part

public class PartImpl extends Object implements Part
Author:
Stuart Douglas
  • Constructor Details

  • Method Details

    • getInputStream

      public InputStream getInputStream() throws IOException
      Description copied from interface: Part
      Gets the content of this part as an InputStream
      Specified by:
      getInputStream in interface Part
      Returns:
      The content of this part as an InputStream
      Throws:
      IOException - If an error occurs in retrieving the content as an InputStream
    • getContentType

      public String getContentType()
      Description copied from interface: Part
      Gets the content type of this part.
      Specified by:
      getContentType in interface Part
      Returns:
      The content type of this part.
    • getName

      public String getName()
      Description copied from interface: Part
      Gets the name of this part
      Specified by:
      getName in interface Part
      Returns:
      The name of this part as a String
    • getSubmittedFileName

      public String getSubmittedFileName()
      Description copied from interface: Part
      Gets the file name specified by the client
      Specified by:
      getSubmittedFileName in interface Part
      Returns:
      the submitted file name
    • getSize

      public long getSize()
      Description copied from interface: Part
      Returns the size of this file.
      Specified by:
      getSize in interface Part
      Returns:
      a long specifying the size of this part, in bytes.
    • write

      public void write(String fileName) throws IOException
      Description copied from interface: Part
      A convenience method to write this uploaded item to disk.

      This method is not guaranteed to succeed if called more than once for the same part. This allows a particular implementation to use, for example, file renaming, where possible, rather than copying all of the underlying data, thus gaining a significant performance benefit.

      Specified by:
      write in interface Part
      Parameters:
      fileName - The location into which the uploaded part should be stored. Relative paths are relative to MultipartConfigElement.getLocation(). Absolute paths are used as provided. Note: that this is a system dependent string and URI notation may not be acceptable on all systems. For portability, this string should be generated with the File or Path APIs.
      Throws:
      IOException - if an error occurs.
    • delete

      public void delete() throws IOException
      Description copied from interface: Part
      Deletes the underlying storage for a file item, including deleting any associated temporary disk file.
      Specified by:
      delete in interface Part
      Throws:
      IOException - if an error occurs.
    • getHeader

      public String getHeader(String name)
      Description copied from interface: Part
      Returns the value of the specified mime header as a String. If the Part did not include a header of the specified name, this method returns null. If there are multiple headers with the same name, this method returns the first header in the part. The header name is case insensitive. You can use this method with any request header.
      Specified by:
      getHeader in interface Part
      Parameters:
      name - a String specifying the header name
      Returns:
      a String containing the value of the requested header, or null if the part does not have a header of that name
    • getHeaders

      public Collection<String> getHeaders(String name)
      Description copied from interface: Part
      Gets the values of the Part header with the given name.

      Any changes to the returned Collection must not affect this Part.

      Part header names are case insensitive.

      Specified by:
      getHeaders in interface Part
      Parameters:
      name - the header name whose values to return
      Returns:
      a (possibly empty) Collection of the values of the header with the given name
    • getHeaderNames

      public Collection<String> getHeaderNames()
      Description copied from interface: Part
      Gets the header names of this Part.

      Some servlet containers do not allow servlets to access headers using this method, in which case this method returns null

      Any changes to the returned Collection must not affect this Part.

      Specified by:
      getHeaderNames in interface Part
      Returns:
      a (possibly empty) Collection of the header names of this Part