public class FileWrapper extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
FileWrapper.FileState |
static class |
FileWrapper.OpenMode |
| Constructor and Description |
|---|
FileWrapper(File file)
Create a new FileWrapper for the given File.
|
FileWrapper(File root,
String str) |
FileWrapper(String str) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canWrite() |
void |
close()
Close the file, and set its state to CLOSED.
|
void |
copyTo(FileWrapper target,
byte[] buffer)
Copy this file to target using buffer to hold data.
|
void |
delete() |
String |
getAbsoluteName() |
FileWrapper.FileState |
getFileState() |
String |
getName() |
void |
open(FileWrapper.OpenMode mode)
Open the (text) file for I/O.
|
byte[] |
readAll() |
String |
readLine()
Read the next line from the text file.
|
String |
toString() |
void |
writeAll(byte[] data) |
void |
writeLine(String line)
Write the line to the end of the file, including a newline.
|
public FileWrapper(File file)
file - File to wrappublic FileWrapper(String str)
public boolean canWrite()
public void delete()
public String getName()
public String getAbsoluteName()
public byte[] readAll()
throws IOException
IOExceptionpublic void writeAll(byte[] data)
throws IOException
IOExceptionpublic String readLine() throws IOException
IOException - for IO errors.public void writeLine(String line) throws IOException
line - The line to write.IOException - for IO errors.public void close()
close in interface Closeableclose in interface AutoCloseablepublic void open(FileWrapper.OpenMode mode) throws IOException
mode - READ or WRITE mode.IOException - for IO exceptions.public FileWrapper.FileState getFileState()
public void copyTo(FileWrapper target, byte[] buffer) throws IOException
target - The FileWrapper to copy data to.buffer - The buffer to use for copying the files.IOException - for IO exceptions.Copyright © 2011–2019 Eclipse Foundation. All rights reserved.