Class Part

java.lang.Object
dev.relism.flash.api.multipart.Part

public final class Part extends Object
One part of a multipart/form-data body produced by Multipart.

Two internal states:

  • Method Details

    • name

      public String name()
      Field or file name from Content-Disposition: form-data; name="...".
    • filename

      public String filename()
      Original filename from filename="...", or null for text fields.
    • contentType

      public String contentType()
      Content-Type declared in the part headers, or null if absent.
    • isFile

      public boolean isFile()
      true if this part has a filename attribute (i.e. a file upload).
    • stream

      public InputStream stream()
      Returns an InputStream over the part body. For buffered parts: returns a fresh reader each call. For streaming file parts: returns the raw socket stream — read once only.
    • materialize

      public byte[] materialize() throws IOException
      Materialises the body into a byte[]. Result is cached; safe to call repeatedly. For streaming file parts: triggers a full read from the socket on first call.
      Throws:
      IOException
    • text

      public String text() throws IOException
      Decodes the body as UTF-8. Materialises if needed; result is cached. For streaming file parts: triggers a full read from the socket on first call.
      Throws:
      IOException