Class UploadFileRequest

java.lang.Object
com.iizix.gyro.UploadFileRequest

public final class UploadFileRequest extends Object
What a client declares about one file when it asks for an upload reservation: the original name, the declared media type, the uncompressed size, the last-modified time, the proposed compression and an optional group name.

Every value is client-supplied and is metadata only: the service never derives a path from the name, never trusts the type before verification, and treats the size as the declared upper bound that quota and verification hold the transfer to.

Author:
Christopher Mindus
  • Field Details

    • COMPRESSION_NONE

      public static final String COMPRESSION_NONE
      Compression proposal: no compression, the bytes arrive as they are.
      See Also:
    • COMPRESSION_GZIP

      public static final String COMPRESSION_GZIP
      Compression proposal: each chunk is an independent gzip member.
      See Also:
    • MAX_NAME_LENGTH

      public static final int MAX_NAME_LENGTH
      The maximum length of an original name that is accepted.
      See Also:
    • name

      public final String name
      The original file name as the client sent it (metadata only).
    • type

      public final String type
      The declared media type, may be empty.
    • size

      public final long size
      The declared uncompressed size in bytes.
    • lastModified

      public final long lastModified
      The client's last-modified time in milliseconds since the epoch, 0 if unknown.
    • compression

      public final String compression
      The compression proposal, COMPRESSION_NONE or COMPRESSION_GZIP.
    • group

      public final String group
      The named group the client placed the file in, may be empty.
  • Constructor Details

    • UploadFileRequest

      public UploadFileRequest(String name, String type, long size, long lastModified, String compression, String group)
      Constructor.
      Parameters:
      name - The original file name, metadata only.
      type - The declared media type, null for none.
      size - The declared uncompressed size in bytes.
      lastModified - The client's last-modified time in milliseconds, 0 if unknown.
      compression - The compression proposal, null or empty for COMPRESSION_NONE.
      group - The group name, null for none.
      Throws:
      IllegalArgumentException - If the name is empty or over-long, the size is negative, or the compression is not one of the two known values.
  • Method Details

    • isGzip

      public boolean isGzip()
      Checks if the proposal is gzip.
      Returns:
      true for COMPRESSION_GZIP.
    • toString

      public String toString()
      Outputs to string, without the name (it is client-supplied and may be hostile to logs).
      Overrides:
      toString in class Object