Class ByteRangeUtils

java.lang.Object
io.meeds.social.attachment.rest.util.ByteRangeUtils

public class ByteRangeUtils extends Object
  • Method Details

    • parse

      public static ByteRange parse(String header, long length)
      Reads the single range of a Range header.
      Parameters:
      header - value of the Range header
      length - size of the file
      Returns:
      the range asked, ByteRange.UNSATISFIABLE when it is outside the file, or null when the whole file is to be answered: no header, another unit than bytes, several ranges or a form that is no range
    • matches

      public static boolean matches(String ifRange, String eTag)
      Parameters:
      ifRange - value of the If-Range header
      eTag - entity tag of the file, unquoted
      Returns:
      true when the range may be answered: no condition, or the tag the client holds is the file's