Class StreamManager

  • public class StreamManager
    extends java.lang.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 Detail

      • logAllLookups

        public static boolean logAllLookups
    • Constructor Detail

      • StreamManager

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

      • 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​(java.lang.String filenameOrURI)
        Open a file using the locators of this StreamManager. Returns null if not found.
      • hasMapping

        public boolean hasMapping​(java.lang.String filenameOrURI)
        Test whether a mapping exists
      • mapURI

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

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

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

        public void setLocationMapper​(LocationMapper _mapper)
        Set the location mapping
      • getLocationMapper

        public LocationMapper getLocationMapper()
        Get the location mapping
      • locators

        public java.util.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.