Class NamedReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Readable

    @Beta
    public class NamedReader
    extends java.io.Reader
    A reader with a name. All reader methods are delegated to the wrapped reader.
    Author:
    bratseth
    • Field Summary

      • Fields inherited from class java.io.Reader

        lock
    • Constructor Summary

      Constructors 
      Constructor Description
      NamedReader​(java.lang.String name, java.io.Reader reader)  
    • Constructor Detail

      • NamedReader

        public NamedReader​(java.lang.String name,
                           java.io.Reader reader)
    • Method Detail

      • getName

        public java.lang.String getName()
      • getReader

        public java.io.Reader getReader()
      • toString

        public java.lang.String toString()
        Returns the name
        Overrides:
        toString in class java.lang.Object
      • nullReader

        public static java.io.Reader nullReader()
      • read

        public int read​(java.nio.CharBuffer charBuffer)
                 throws java.io.IOException
        Specified by:
        read in interface java.lang.Readable
        Overrides:
        read in class java.io.Reader
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class java.io.Reader
        Throws:
        java.io.IOException
      • read

        public int read​(char[] chars)
                 throws java.io.IOException
        Overrides:
        read in class java.io.Reader
        Throws:
        java.io.IOException
      • read

        public int read​(char[] chars,
                        int i,
                        int i1)
                 throws java.io.IOException
        Specified by:
        read in class java.io.Reader
        Throws:
        java.io.IOException
      • skip

        public long skip​(long l)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.Reader
        Throws:
        java.io.IOException
      • ready

        public boolean ready()
                      throws java.io.IOException
        Overrides:
        ready in class java.io.Reader
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.Reader
      • mark

        public void mark​(int i)
                  throws java.io.IOException
        Overrides:
        mark in class java.io.Reader
        Throws:
        java.io.IOException
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.Reader
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class java.io.Reader
        Throws:
        java.io.IOException
      • transferTo

        public long transferTo​(java.io.Writer out)
                        throws java.io.IOException
        Overrides:
        transferTo in class java.io.Reader
        Throws:
        java.io.IOException
      • closeAll

        public static void closeAll​(java.util.List<NamedReader> readers)
        Convenience method for closing a list of readers. Does nothing if the given reader list is null.