jp.sourceforge.simplefh
Interface SimpleFileReader

All Known Implementing Classes:
SimpleFileReaderImpl

public interface SimpleFileReader

Simple file reader interface.

It's too much of a bother to treat file resources in Java.
This module offers simple interface to treat file resources.

It is able to access os file system resource(using string file path value) or access ClassPathResource object.

Version:
1.0
Author:
Kazuhiro Sera

Method Summary
 Integer getDefaultArrayLength()
          Get default array length to buffering.
 String getEncodingToRead()
          Get encoding to read.
 byte[] read2ByteArray(ClassPathResource resourcePath)
          Read resource content(convert to byte array).
 byte[] read2ByteArray(File file)
          Read file content(convert to byte array).
 byte[] read2ByteArray(String path)
          Read file content(convert to byte array).
 char[] read2CharArray(ClassPathResource resourcePath)
          Read resource content(convert to char array).
 char[] read2CharArray(File file)
          Read file content(convert to char array).
 char[] read2CharArray(String path)
          Read file content(convert to char array).
 String[] read2StringLineArray(ClassPathResource resourcePath)
          Read resource content(convert to String array).
 String[] read2StringLineArray(File file)
          Read file content(convert to String array).
 String[] read2StringLineArray(String path)
          Read file content(convert to String array).
 List<String> read2StringLineList(ClassPathResource resourcePath)
          Read resource content(convert to String List).
 List<String> read2StringLineList(File file)
          Read file content(convert to String List).
 List<String> read2StringLineList(String path)
          Read file content(convert to String List).
 SimpleFileReader setDefaultArrayLength(Integer defaultArrayLength)
          Set default array length to buffering.
 SimpleFileReader setEncodingToRead(String encodingToRead)
          Set encoding to read.
 

Method Detail

read2CharArray

char[] read2CharArray(String path)
                      throws IOException
Read file content(convert to char array).

This method go through the following steps to read target path.
(1) try to read the path in class path resource
(2) try to read from full path on os file system

Parameters:
path - readable file resource of file path
Returns:
file content
Throws:
IOException - file read error

read2CharArray

char[] read2CharArray(ClassPathResource resourcePath)
                      throws IOException
Read resource content(convert to char array).

Parameters:
resourcePath - readable class path resource
Returns:
file content
Throws:
IOException

read2CharArray

char[] read2CharArray(File file)
                      throws IOException
Read file content(convert to char array).

Parameters:
file - readable file object
Returns:
file content
Throws:
IOException - file read error

read2ByteArray

byte[] read2ByteArray(String path)
                      throws IOException
Read file content(convert to byte array).

This method go through the following steps to read target path.
(1) try to read the path in class path resource
(2) try to read from full path on os file system

Parameters:
path - readable file resource of file path
Returns:
file content
Throws:
IOException - file read error

read2ByteArray

byte[] read2ByteArray(ClassPathResource resourcePath)
                      throws IOException
Read resource content(convert to byte array).

Parameters:
resourcePath - readable class path resource
Returns:
file content
Throws:
IOException

read2ByteArray

byte[] read2ByteArray(File file)
                      throws IOException
Read file content(convert to byte array).

Parameters:
file - readable file object
Returns:
file content
Throws:
IOException - file read error

read2StringLineList

List<String> read2StringLineList(String path)
                                 throws IOException
Read file content(convert to String List).

This method go through the following steps to read target path.
(1) try to read the path in class path resource
(2) try to read from full path on os file system

Parameters:
path - readable file resource of file path
Returns:
file content
Throws:
IOException - file read error

read2StringLineList

List<String> read2StringLineList(ClassPathResource resourcePath)
                                 throws IOException
Read resource content(convert to String List).

Parameters:
resourcePath - readable class path resource
Returns:
file content
Throws:
IOException

read2StringLineList

List<String> read2StringLineList(File file)
                                 throws IOException
Read file content(convert to String List).

Parameters:
file - readable file object
Returns:
file content
Throws:
IOException - file read error

read2StringLineArray

String[] read2StringLineArray(String path)
                              throws IOException
Read file content(convert to String array).

This method go through the following steps to read target path.
(1) try to read the path in class path resource
(2) try to read from full path on os file system

Parameters:
path - readable file resource of file path
Returns:
file content
Throws:
IOException - file read error

read2StringLineArray

String[] read2StringLineArray(ClassPathResource resourcePath)
                              throws IOException
Read resource content(convert to String array).

Parameters:
resourcePath - readable class path resource
Returns:
file content
Throws:
IOException

read2StringLineArray

String[] read2StringLineArray(File file)
                              throws IOException
Read file content(convert to String array).

Parameters:
file - readable file object
Returns:
file content
Throws:
IOException - file read error

getEncodingToRead

String getEncodingToRead()
Get encoding to read.

Returns:
encoding

setEncodingToRead

SimpleFileReader setEncodingToRead(String encodingToRead)
Set encoding to read.

Parameters:
encodingToRead - encoding
Returns:
reader

getDefaultArrayLength

Integer getDefaultArrayLength()
Get default array length to buffering.

Returns:
buffering array length

setDefaultArrayLength

SimpleFileReader setDefaultArrayLength(Integer defaultArrayLength)
Set default array length to buffering.

Parameters:
defaultArrayLength - default array length to buffering
Returns:
reader