|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.cotta.TEntry
net.sf.cotta.TFile
public class TFile
The class that represents the file. Even though the constructor is public, the usual way is to create TFile through TFile, TDirectory, and TFileFactory
TFileFactory.file(String),
TFileFactory.fileFromJavaFile(java.io.File),
TDirectory.file(String),
TDirectory.file(TPath)| Field Summary |
|---|
| Fields inherited from class net.sf.cotta.TEntry |
|---|
path |
| Constructor Summary | |
|---|---|
TFile(FileSystem fileSystem,
TPath path)
Deprecated. use the other constructor for default encoding support provided by factory |
|
TFile(TFileFactory factory,
TPath path)
Create TFile instance backed up by the factory |
|
| Method Summary | ||
|---|---|---|
void |
append(OutputProcessor processor)
|
|
java.lang.String |
basename()
|
|
void |
copyTo(java.io.OutputStream outputStream)
|
|
void |
copyTo(TFile target)
|
|
TFile |
create()
|
|
void |
delete()
|
|
TFile |
ensureExists()
|
|
boolean |
exists()
|
|
java.lang.String |
extname()
|
|
java.nio.channels.FileChannel |
inputChannel()
Creates the input channel for the file |
|
java.io.InputStream |
inputStream()
Create the input stream |
|
IoFactory |
io()
Deprecated. use TFile itself is more effective |
|
long |
lastModified()
|
|
long |
length()
|
|
java.lang.String |
load()
Load the content of the file into string using system default encoding |
|
void |
moveTo(TFile destination)
|
|
void |
open(IoProcessor processor)
Deprecated. use read(), write(), and append() instead |
|
void |
open(LineProcessor lineProcessor)
Deprecated. use #read(LineProcessor) |
|
java.io.OutputStream |
outputStream(OutputMode mode)
Create the output stream |
|
|
parse(Parser<T> parser)
Parse the file into an object |
|
void |
read(InputProcessor processor)
Read the file with a input processor |
|
void |
read(LineProcessor lineProcessor)
Read the file with a line processor |
|
TFile |
save(java.lang.String content)
Saves the content to the file |
|
TFile |
toCanonicalFile()
Converts to the instance with a cononical path |
|
void |
write(OutputProcessor processor)
|
|
| Methods inherited from class net.sf.cotta.TEntry |
|---|
compareTo, equals, factory, filesystem, hashCode, isChildOf, name, parent, path, pathFrom, toCanonicalPath, toJavaFile, toPath, toPathString, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TFile(FileSystem fileSystem,
TPath path)
fileSystem - file system backing the filepath - path for the fileTFile(TFileFactory, TPath),
TFile(TFileFactory, TPath)
public TFile(TFileFactory factory,
TPath path)
factory - file factory as the file systempath - path for the file| Method Detail |
|---|
public boolean exists()
exists in class TEntry
public TFile create()
throws TIoException
TIoExceptionpublic java.lang.String extname()
public java.lang.String basename()
public void delete()
throws TIoException
TIoException
public java.nio.channels.FileChannel inputChannel()
throws TIoException
TIoException - error in creating the input channel
public java.io.OutputStream outputStream(OutputMode mode)
throws TIoException
mode - output mode
TIoException - error in creating the output stream
public java.io.InputStream inputStream()
throws TIoException
TIoException - error in creating the input stream
public void copyTo(TFile target)
throws TIoException
TIoException
public void copyTo(java.io.OutputStream outputStream)
throws TIoException
TIoException
public void moveTo(TFile destination)
throws TIoException
TIoException
public long length()
throws TIoException
TIoException
public long lastModified()
throws TIoException
TIoException
public TFile ensureExists()
throws TIoException
TIoException@Deprecated public IoFactory io()
inputChannel(),
inputStream(),
outputStream(net.sf.cotta.io.OutputMode)
@Deprecated
public void open(IoProcessor processor)
throws TIoException
processor - processor call back
TIoException - error in the processingread(net.sf.cotta.io.InputProcessor),
write(net.sf.cotta.io.OutputProcessor),
append(net.sf.cotta.io.OutputProcessor)
public void read(InputProcessor processor)
throws TIoException
processor - processor for the input stream
TIoException - error in reading the file
public void read(LineProcessor lineProcessor)
throws TIoException
lineProcessor - line processor for the lines
TIoException - error in reading the file
public void append(OutputProcessor processor)
throws TIoException
TIoException
public void write(OutputProcessor processor)
throws TIoException
TIoException
@Deprecated
public void open(LineProcessor lineProcessor)
throws TIoException
lineProcessor - line processor for the lines
TIoException - error in reading the fileread(net.sf.cotta.io.LineProcessor)
public java.lang.String load()
throws TIoException
TIoException - error in reading the file
public TFile save(java.lang.String content)
throws TIoException
content - content to save
TIoException - if there are any exception thrown during the operation
public <T> T parse(Parser<T> parser)
throws TIoException
T - the type of the object to returnparser - parser to call after opening the file for read
TIoException - error in reading the filepublic TFile toCanonicalFile()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||