Class ResourcePattern.PathSpliterator

java.lang.Object
java.util.Spliterators.AbstractSpliterator<String>
org.jgrapes.http.ResourcePattern.PathSpliterator
All Implemented Interfaces:
Spliterator<String>
Enclosing class:
ResourcePattern

Returns the segments of the path.

If the path starts with a slash, an empty string is returned as first segment. If the path ends with a slash, an empty string is returned as final segment.

  • Constructor Details

    • PathSpliterator

      public PathSpliterator(String path)
      Creates a new spliterator for the given path, using “/” as path separator.
      Parameters:
      path - the path
    • PathSpliterator

      public PathSpliterator(String path, String delimiters)
      Creates a new spliterator for the given path, using the characters from delimiters as seperators.
      Parameters:
      path - the path
      delimiters - the delimiters
  • Method Details

    • stream

      public static Stream<String> stream(String path)
      Creates a new stream for the given path, using “/” as path separator.
      Parameters:
      path - the path
    • stream

      public static Stream<String> stream(String path, String delimiters)
      Creates a new stream for the given path, using the characters from delimiters as seperators.
      Parameters:
      path - the path
      delimiters - the delimiters
    • tryAdvance

      public boolean tryAdvance(Consumer<? super String> consumer)