Package com.gengoai.io.resource
Class ReaderResource
- java.lang.Object
-
- com.gengoai.io.resource.BaseResource
-
- com.gengoai.io.resource.ReaderResource
-
- All Implemented Interfaces:
NonTraversableResource
,ReadOnlyResource
,Resource
,Serializable
public class ReaderResource extends BaseResource implements ReadOnlyResource, NonTraversableResource
Resource that wraps aReader
- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.gengoai.io.resource.Resource
Resource.Deserializer
-
-
Field Summary
-
Fields inherited from interface com.gengoai.io.resource.Resource
ALL_FILE_PATTERN
-
-
Constructor Summary
Constructors Constructor Description ReaderResource(Reader reader)
Instantiates a new Reader resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
boolean
exists()
Exists boolean.int
hashCode()
byte[]
readBytes()
Reads the resource into an array of bytes.Reader
reader()
Opens a reader using guessing the encoding and falling back to the default on the resource.-
Methods inherited from class com.gengoai.io.resource.BaseResource
asFile, asURI, baseName, canRead, canWrite, compressed, createInputStream, createOutputStream, descriptor, getCharset, inputStream, isCompressed, isDirectory, outputStream, path, setCharset, setCompression, setIsCompressed, toString, uncompressed
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.gengoai.io.resource.NonTraversableResource
childIterator, childIterator, getChild, getChildren, getChildren, getChildren, getChildren, getChildren, getParent
-
Methods inherited from interface com.gengoai.io.resource.ReadOnlyResource
append, canRead, canWrite
-
Methods inherited from interface com.gengoai.io.resource.Resource
append, asFile, asPath, asURI, asURL, baseName, compressed, copy, delete, delete, deleteOnExit, descriptor, forEach, getCharset, inputStream, isCompressed, isDirectory, lines, mkdir, mkdirs, outputStream, path, readLines, readObject, readToString, setCharset, setCompression, setIsCompressed, uncompressed, write, write, writeObject, writer
-
-
-
-
Constructor Detail
-
ReaderResource
public ReaderResource(Reader reader)
Instantiates a new Reader resource.- Parameters:
reader
- the reader to wrap
-
-
Method Detail
-
reader
public Reader reader() throws IOException
Description copied from interface:Resource
Opens a reader using guessing the encoding and falling back to the default on the resource.- Specified by:
reader
in interfaceResource
- Returns:
- A reader
- Throws:
IOException
- the io exception
-
exists
public boolean exists()
Description copied from interface:Resource
Exists boolean.
-
readBytes
public byte[] readBytes() throws IOException
Description copied from interface:Resource
Reads the resource into an array of bytes.
- Specified by:
readBytes
in interfaceResource
- Returns:
- An array of bytes representing the content of the resource.
- Throws:
IOException
- the io exception
-
-