Class StreamManager


public class StreamManager extends Object
Management of stream opening, including redirecting through a location mapper whereby a name (e.g. URL) is redirected to another name (e.g. local file). Includes filename to IRI, handling ".gz" and "-"
  • Field Details

    • logAllLookups

      public static boolean logAllLookups
  • Constructor Details

    • StreamManager

      public StreamManager()
      Create a StreamManager with no locator or location mapper.
  • Method Details

    • createStd

      public static StreamManager createStd()
      Return a default configuration StreamManager with a LocatorFile, LocatorHTTP, LocatorFTP and LocatorClassLoader
    • get

      public static StreamManager get()
      Return the global StreamManager.
    • get

      public static StreamManager get(Context context)
      Return the StreamManager in a context, or the global one if the context is null or does not contain a valid entry for a StreamManager.

      The StreamManager is keyed in the context by SysRIOT.sysStreamManager.

    • setGlobal

      public static void setGlobal(StreamManager streamManager)
      Set the global StreamManager.
    • clone

      public StreamManager clone()
      Create a deep copy of this StreamManager
    • open

      public TypedInputStream open(String filenameOrURI)
      Open a file using the locators of this StreamManager. Returns null if not found.
    • hasMapping

      public boolean hasMapping(String filenameOrURI)
      Test whether a mapping exists
    • mapURI

      public String mapURI(String filenameOrURI)
      Apply the mapping of a filename or URI
    • openNoMap

      public TypedInputStream openNoMap(String filenameOrURI)
      Open a file using the locators of this StreamManager but without location mapping. Throws RiotNotFoundException if not found.
    • openNoMapOrNull

      public TypedInputStream openNoMapOrNull(String filenameOrURI)
      Open a file using the locators of this StreamManager without location mapping. Return null if not found
    • setLocationMapper

      @Deprecated public void setLocationMapper(LocationMapper mapper)
      Set the location mapping
    • getLocationMapper

      @Deprecated public LocationMapper getLocationMapper()
      Get the location mapping
    • locationMapper

      public StreamManager locationMapper(LocationMapper mapper)
      Set the location mapping
    • locationMapper

      public LocationMapper locationMapper()
      Set the location mapping
    • locators

      public List<Locator> locators()
      Return an immutable list of all the handlers
    • remove

      public void remove(Locator loc)
      Remove a locator.
    • clearLocators

      public void clearLocators()
      Remove all locators
    • addLocator

      public StreamManager addLocator(Locator loc)
      Add a locator to the end of the locators list. Returns this StreamManager.