jp.sourceforge.simplefh
Interface SimpleFileWriter

All Known Implementing Classes:
SimpleFileWriterImpl

public interface SimpleFileWriter

Simple file accessor 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
 String getEncoding()
          Get encoding.
 String getLineBreak()
          Get line break.
 String getWriteTarget()
          Get write target absolute file path.
 SimpleFileWriter setEncoding(String encoding)
          Set encoding.
 SimpleFileWriter setLineBreak(String lineBreak)
          Set line break.
 SimpleFileWriter setWriteTarget(ClassPathResource resourcePath)
          Set write target.
 SimpleFileWriter setWriteTarget(File file)
          Set write target.
 SimpleFileWriter setWriteTarget(String path)
          Set write target.
 void write(byte[] content)
          Write file with byte array.
 void write(List<String> lines)
          Write file with String List.
 void write(String strContent)
          Write file with String.
 void write(String[] lines)
          Write file with String array.
 

Method Detail

write

void write(String[] lines)
           throws IOException
Write file with String array.

Parameters:
lines - String array contents
Throws:
IOException - cannot write file

write

void write(List<String> lines)
           throws IOException
Write file with String List.

Parameters:
lines - String List contents
Throws:
IOException - cannot write file

write

void write(String strContent)
           throws IOException
Write file with String.

Parameters:
strContent - String contents
Throws:
IOException - cannot write file

write

void write(byte[] content)
           throws IOException
Write file with byte array.

Parameters:
content - byte array contents
Throws:
IOException - cannot write file

getWriteTarget

String getWriteTarget()
Get write target absolute file path.

Returns:
write target file path

setWriteTarget

SimpleFileWriter setWriteTarget(String path)
Set write target.

Parameters:
path - write target file path

setWriteTarget

SimpleFileWriter setWriteTarget(ClassPathResource resourcePath)
Set write target.

If destination file was in archive path,
it's impossible to write and all write methods will throw IOException.

Parameters:
resourcePath - write target resource path

setWriteTarget

SimpleFileWriter setWriteTarget(File file)
Set write target.

Parameters:
file - write target file

getLineBreak

String getLineBreak()
Get line break.

Returns:
line break

setLineBreak

SimpleFileWriter setLineBreak(String lineBreak)
Set line break.

Parameters:
lineBreak - line break

getEncoding

String getEncoding()
Get encoding.

Returns:
encoding

setEncoding

SimpleFileWriter setEncoding(String encoding)
Set encoding.

Parameters:
encoding - specified encoding