test_class.declarator: rangesHeaderDelegate
test_class.modifier: private
test_class.original_string: private RangesHeaderDelegate rangesHeaderDelegate;
test_class.type: RangesHeaderDelegate
test_class.var_name: rangesHeaderDelegate
test_class.file: everrest-core/src/test/java/org/everrest/core/impl/header/RangesHeaderDelegateTest.java
test_class.identifier: RangesHeaderDelegateTest
test_case.body: @Test
      public void parsesMultiRangeWithoutStart() {
          Ranges ranges = rangesHeaderDelegate.fromString("bytes=49-100,150-250");
          assertEquals(newArrayList(new Range(49, 100), new Range(150, 250)), ranges.getRanges());
      }
test_case.class_method_signature: RangesHeaderDelegateTest.parsesMultiRangeWithoutStart()
test_case.full_signature: @Test public void parsesMultiRangeWithoutStart()
test_case.identifier: parsesMultiRangeWithoutStart
test_case.invocations: fromString assertEquals newArrayList getRanges
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void parsesMultiRangeWithoutStart()
focal_class.file: everrest-core/src/main/java/org/everrest/core/impl/header/RangesHeaderDelegate.java
focal_class.identifier: RangesHeaderDelegate
focal_class.interfaces: implements RuntimeDelegate.HeaderDelegate<Ranges>
focal_class.class_method_signature: RangesHeaderDelegate.fromString(String value)
focal_class.full_signature: @Override public Ranges fromString(String value)
focal_class.identifier: fromString
focal_class.modifiers: @Override public
focal_class.parameters: (String value)
focal_class.return: Ranges
focal_class.signature: Ranges fromString(String value)
focal_class.class_method_signature: RangesHeaderDelegate.toString(Ranges value)
focal_class.full_signature: @Override public String toString(Ranges value)
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: (Ranges value)
focal_class.return: String
focal_class.signature: String toString(Ranges value)
focal_method.body: @Override
      public Ranges fromString(String value) throws IllegalArgumentException {
          if (value == null) {
              throw new IllegalArgumentException();
          }
  
          if (!value.startsWith("bytes")) {
              throw new IllegalArgumentException(String.format("Invalid byte range: %s", value));
          }
  
          int eq = scan(value, '=');
          if (charAtIsNot(value, eq, '=')) {
              throw new IllegalArgumentException(String.format("Invalid byte range: %s", value));
          }
  
          value = value.substring(eq + 1);
  
          String[] tokens = value.split(",");
          List<Range> ranges = new ArrayList<>();
          for (String token : tokens) {
              long start = 0;
              long end = -1L;
              token = token.trim();
              int dash = scan(token, '-');
              if (charAtIsNot(token, dash, '-')) {
                  throw new IllegalArgumentException("Invalid byte range.");
              } else if (dash == 0) {
                  start = Long.parseLong(token);
              } else if (dash > 0) {
                  start = Long.parseLong(token.substring(0, dash).trim());
                  if (dash < token.length() - 1) {
                      end = Long.parseLong(token.substring(dash + 1, token.length()).trim());
                  }
              }
              ranges.add(new Range(start, end));
          }
          return new Ranges(ranges);
      }
focal_method.class_method_signature: RangesHeaderDelegate.fromString(String value)
focal_method.full_signature: @Override public Ranges fromString(String value)
focal_method.identifier: fromString
focal_method.invocations: startsWith format scan charAtIsNot format substring split trim scan charAtIsNot parseLong parseLong trim substring length parseLong trim substring length add
focal_method.modifiers: @Override public
focal_method.parameters: (String value)
focal_method.return: Ranges
focal_method.signature: Ranges fromString(String value)