Class Ranges


  • public class Ranges
    extends java.lang.Object
    Represents the value of an HTTP Range header.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Ranges.Entry
      Represents a single range entry with a start and end position.
    • Constructor Summary

      Constructors 
      Constructor Description
      Ranges​(java.lang.String units, java.util.List<Ranges.Entry> entries)
      Creates a new Ranges instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<Ranges.Entry> getEntries()
      Returns the list of range entries.
      java.lang.String getUnits()
      Returns the range units (e.g., "bytes").
      static Ranges parse​(java.io.StringReader input)
      Parses a Range header from an HTTP header.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Ranges

        public Ranges​(java.lang.String units,
                      java.util.List<Ranges.Entry> entries)
        Creates a new Ranges instance.
        Parameters:
        units - the range units (e.g., "bytes"), or null
        entries - the list of range entries
    • Method Detail

      • getEntries

        public java.util.List<Ranges.Entry> getEntries()
        Returns the list of range entries.
        Returns:
        an unmodifiable list of range entries
      • getUnits

        public java.lang.String getUnits()
        Returns the range units (e.g., "bytes").
        Returns:
        the range units, or null if not specified
      • parse

        public static Ranges parse​(java.io.StringReader input)
                            throws java.io.IOException
        Parses a Range header from an HTTP header.
        Parameters:
        input - a reader over the header text
        Returns:
        a set of ranges parsed from the input, or null if not valid
        Throws:
        java.io.IOException - if there was a problem reading the input