Package com.yahoo.io.reader
Class NamedReader
- java.lang.Object
-
- java.io.Reader
-
- com.yahoo.io.reader.NamedReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
public class NamedReader extends Reader
A reader with a name. All reader methods are delegated to the wrapped reader.- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description NamedReader(String name, Reader reader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static void
closeAll(List<NamedReader> readers)
Convenience method for closing a list of readers.String
getName()
Reader
getReader()
void
mark(int i)
boolean
markSupported()
static Reader
nullReader()
int
read()
int
read(char[] chars)
int
read(char[] chars, int i, int i1)
int
read(CharBuffer charBuffer)
boolean
ready()
void
reset()
long
skip(long l)
String
toString()
Returns the namelong
transferTo(Writer out)
-
-
-
Method Detail
-
getName
public String getName()
-
getReader
public Reader getReader()
-
nullReader
public static Reader nullReader()
-
read
public int read(CharBuffer charBuffer) throws IOException
- Specified by:
read
in interfaceReadable
- Overrides:
read
in classReader
- Throws:
IOException
-
read
public int read() throws IOException
- Overrides:
read
in classReader
- Throws:
IOException
-
read
public int read(char[] chars) throws IOException
- Overrides:
read
in classReader
- Throws:
IOException
-
read
public int read(char[] chars, int i, int i1) throws IOException
- Specified by:
read
in classReader
- Throws:
IOException
-
skip
public long skip(long l) throws IOException
- Overrides:
skip
in classReader
- Throws:
IOException
-
ready
public boolean ready() throws IOException
- Overrides:
ready
in classReader
- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classReader
-
mark
public void mark(int i) throws IOException
- Overrides:
mark
in classReader
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classReader
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-
transferTo
public long transferTo(Writer out) throws IOException
- Overrides:
transferTo
in classReader
- Throws:
IOException
-
closeAll
public static void closeAll(List<NamedReader> readers)
Convenience method for closing a list of readers. Does nothing if the given reader list is null.
-
-