| java.lang.Object com.ibm.icu.impl.data.ResourceReader
ResourceReader | public class ResourceReader (Code) | | A reader for text resource data in the current package or the package
of a given class object. The
resource data is loaded through the class loader, so it will
typically be a file in the same directory as the *.class files, or
a file within a JAR file in the corresponding subdirectory. The
file must be a text file in one of the supported encodings; when the
resource is opened by constructing a ResourceReader
object the encoding is specified.
author: Alan Liu |
Constructor Summary | |
public | ResourceReader(String resourceName, String encoding) Construct a reader object for the text file of the given name
in this package, using the given encoding. | public | ResourceReader(String resourceName) Construct a reader object for the text file of the given name
in this package, using the default encoding. | public | ResourceReader(Class rootClass, String resourceName, String encoding) Construct a reader object for the text file of the given name
in the given class's package, using the given encoding. | public | ResourceReader(InputStream is, String resourceName) | public | ResourceReader(Class rootClass, String resourceName) Construct a reader object for the text file of the given name
in the given class's package, using the default encoding. |
Method Summary | |
public String | describePosition() Return a string description of the position of the last line
returned by readLine() or readLineSkippingComments(). | public int | getLineNumber() Return the one-based line number of the last line returned by
readLine() or readLineSkippingComments(). | public String | readLine() Read and return the next line of the file or null
if the end of the file has been reached. | public String | readLineSkippingComments(boolean trim) Read a line, ignoring blank lines and lines that start with
'#'. | public String | readLineSkippingComments() Read a line, ignoring blank lines and lines that start with
'#'. | public void | reset() Reset this reader so that the next call to
readLine() returns the first line of the file
again. |
ResourceReader | public ResourceReader(String resourceName, String encoding) throws UnsupportedEncodingException(Code) | | Construct a reader object for the text file of the given name
in this package, using the given encoding.
Parameters: resourceName - the name of the text file located in thispackage's ".data" subpackage. Parameters: encoding - the encoding of the text file; if unsupportedan exception is thrown exception: UnsupportedEncodingException - ifencoding is not supported by the JDK. |
ResourceReader | public ResourceReader(String resourceName)(Code) | | Construct a reader object for the text file of the given name
in this package, using the default encoding.
Parameters: resourceName - the name of the text file located in thispackage's ".data" subpackage. |
ResourceReader | public ResourceReader(Class rootClass, String resourceName, String encoding) throws UnsupportedEncodingException(Code) | | Construct a reader object for the text file of the given name
in the given class's package, using the given encoding.
Parameters: resourceName - the name of the text file located in thegiven class's package. Parameters: encoding - the encoding of the text file; if unsupportedan exception is thrown exception: UnsupportedEncodingException - ifencoding is not supported by the JDK. |
ResourceReader | public ResourceReader(Class rootClass, String resourceName)(Code) | | Construct a reader object for the text file of the given name
in the given class's package, using the default encoding.
Parameters: resourceName - the name of the text file located in thegiven class's package. |
describePosition | public String describePosition()(Code) | | Return a string description of the position of the last line
returned by readLine() or readLineSkippingComments().
|
getLineNumber | public int getLineNumber()(Code) | | Return the one-based line number of the last line returned by
readLine() or readLineSkippingComments(). Should only be called
after a call to one of these methods; otherwise the return
value is undefined.
|
readLine | public String readLine() throws IOException(Code) | | Read and return the next line of the file or null
if the end of the file has been reached.
|
readLineSkippingComments | public String readLineSkippingComments(boolean trim) throws IOException(Code) | | Read a line, ignoring blank lines and lines that start with
'#'.
Parameters: trim - if true then trim leading rule white space. |
readLineSkippingComments | public String readLineSkippingComments() throws IOException(Code) | | Read a line, ignoring blank lines and lines that start with
'#'. Do not trim leading rule white space.
|
reset | public void reset()(Code) | | Reset this reader so that the next call to
readLine() returns the first line of the file
again. This is a somewhat expensive call, however, calling
reset() after calling it the first time does
nothing if readLine() has not been called in
between.
|
|
|