Package com.yahoo.io.reader
Class NamedReader
- java.lang.Object
-
- java.io.Reader
-
- com.yahoo.io.reader.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
-
-
Constructor Summary
Constructors Constructor Description NamedReader(java.lang.String name, java.io.Reader reader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static void
closeAll(java.util.List<NamedReader> readers)
Convenience method for closing a list of readers.java.lang.String
getName()
java.io.Reader
getReader()
void
mark(int i)
boolean
markSupported()
static java.io.Reader
nullReader()
int
read()
int
read(char[] chars)
int
read(char[] chars, int i, int i1)
int
read(java.nio.CharBuffer charBuffer)
boolean
ready()
void
reset()
long
skip(long l)
java.lang.String
toString()
Returns the namelong
transferTo(java.io.Writer out)
-
-
-
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 classjava.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 interfacejava.lang.Readable
- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
read
public int read(char[] chars) throws java.io.IOException
- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
read
public int read(char[] chars, int i, int i1) throws java.io.IOException
- Specified by:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
skip
public long skip(long l) throws java.io.IOException
- Overrides:
skip
in classjava.io.Reader
- Throws:
java.io.IOException
-
ready
public boolean ready() throws java.io.IOException
- Overrides:
ready
in classjava.io.Reader
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.Reader
-
mark
public void mark(int i) throws java.io.IOException
- Overrides:
mark
in classjava.io.Reader
- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.Reader
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classjava.io.Reader
- Throws:
java.io.IOException
-
transferTo
public long transferTo(java.io.Writer out) throws java.io.IOException
- Overrides:
transferTo
in classjava.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.
-
-