Class InputWithFallback

  • All Implemented Interfaces:
    Input

    public final class InputWithFallback
    extends Object
    implements Input
    Input that returns an alternative input if the main one throws IOException.

    There is no thread-safety guarantee.

    Since:
    0.9
    • Constructor Detail

      • InputWithFallback

        public InputWithFallback​(Input input)
        Ctor.
        Parameters:
        input - Main input
      • InputWithFallback

        public InputWithFallback​(Input input,
                                 Input alt)
        Ctor.
        Parameters:
        input - Main input
        alt - Alternative
      • InputWithFallback

        public InputWithFallback​(Input input,
                                 Func<IOException,​Input> alt)
        Ctor.
        Parameters:
        input - Main input
        alt - Alternative
    • Method Detail

      • stream

        public InputStream stream()
                           throws Exception
        Description copied from interface: Input
        Get read access to it.
        Specified by:
        stream in interface Input
        Returns:
        InputStream to read from
        Throws:
        Exception - If something goes wrong