ByteRange (Google App Engine API for Java)

com.google.appengine.api.blobstore

Class ByteRange

  • java.lang.Object
    • com.google.appengine.api.blobstore.ByteRange


  • public class ByteRange
    extends java.lang.Object
    A byte range as parsed from a request Range header. Format produced by this class is also compatible with the X-AppEngine-BlobRange header, used for serving sub-ranges of blobs.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ByteRange(long start)
      Constructor.
      ByteRange(long start, long end)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean equals(java.lang.Object object)
      Two ByteRange objects are considered equal if they have the same start and end.
      long getEnd()
      Get end index of byte range.
      long getStart()
      Get start index of byte range.
      boolean hasEnd()
      Indicates whether or not this byte range indicates an end.
      int hashCode() 
      static ByteRange parse(java.lang.String byteRange)
      Parse byte range from header.
      static ByteRange parseContentRange(java.lang.String contentRange)
      Parse content range from header for byte-range only.
      java.lang.String toString()
      Format byte range for use in header.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ByteRange

        public ByteRange(long start)
        Constructor.
        Parameters:
        start - Start index of blob range to serve. If negative, serve the last abs(start) bytes of the blob.
      • ByteRange

        public ByteRange(long start,
                         long end)
        Constructor.
        Parameters:
        start - Start index of blob range to serve. May not be negative.
        end - End index of blob range to serve. Index is inclusive, meaning the byte indicated by end is included in the response.
    • Method Detail

      • hasEnd

        public boolean hasEnd()
        Indicates whether or not this byte range indicates an end.
        Returns:
        true if byte range has an end.
      • getStart

        public long getStart()
        Get start index of byte range.
        Returns:
        Start index of byte range.
      • getEnd

        public long getEnd()
        Get end index of byte range.
        Returns:
        End index of byte range.
        Throws:
        java.lang.IllegalStateException - if byte range does not have an end range.
      • toString

        public java.lang.String toString()
        Format byte range for use in header.
        Overrides:
        toString in class java.lang.Object
      • parse

        public static ByteRange parse(java.lang.String byteRange)
        Parse byte range from header.
        Parameters:
        byteRange - Byte range string as received from header.
        Returns:
        ByteRange object set to byte range as parsed from string.
        Throws:
        RangeFormatException - Unable to parse header because of invalid format.
        UnsupportedRangeFormatException - Header is a valid HTTP range header, the specific form is not supported by app engine. This includes unit types other than "bytes" and multiple ranges.
      • parseContentRange

        public static ByteRange parseContentRange(java.lang.String contentRange)
        Parse content range from header for byte-range only.
        Parameters:
        contentRange - Content range string as received from header.
        Returns:
        ByteRange object set to byte range as parsed from string, but does not include the size information.
        Throws:
        RangeFormatException - Unable to parse header because of invalid format.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals(java.lang.Object object)
        Two ByteRange objects are considered equal if they have the same start and end.
        Overrides:
        equals in class java.lang.Object