public abstract class File extends Path
Constructor and Description |
---|
File() |
Modifier and Type | Method and Description |
---|---|
void |
copyTo(OutputStream outputStream)
Copy the contents of this file to the specified output stream.
|
abstract void |
delete()
Delete this file if it exists.
|
abstract boolean |
exists()
See if the file exists.
|
abstract long |
getLastModifiedTime()
Get the last modified / last write timestamp of this file.
|
abstract Directory |
getParent() |
abstract long |
getSize()
Get the size of this file.
|
abstract void |
moveTo(File destination) |
abstract OutputStream |
openForCreate()
Open the file for writing.
|
OutputStream |
openForCreateAtomic() |
OutputStream |
openForCreateAtomic(long lastModifiedTime)
Open the file for writing/creating, replacing the current file if it already exists.
|
abstract InputStream |
openForRead() |
Utf8OutputStreamWriter |
openUtf8ForCreate()
This is a convenience method to open a UTF8 text file for writing.
|
Utf8OutputStreamWriter |
openUtf8ForCreateAtomic()
This is a convenience method to open a UTF8 text file for writing.
|
Utf8InputStreamReader |
openUtf8ForRead()
This is a convenience method to open a UTF8 text file for read.
|
abstract void |
renameTo(java.lang.String newName)
Rename this file, giving it a new name in the same directory.
|
abstract void |
setLastModifiedTime(long time)
Set the last modified / last write timestamp of this file.
|
getName, getNameExtension, getPathString, toString
public abstract InputStream openForRead()
public void copyTo(OutputStream outputStream)
outputStream
- output stream to write topublic Utf8InputStreamReader openUtf8ForRead()
new
Utf8InputStreamReader(openForRead())
.public abstract OutputStream openForCreate()
public Utf8OutputStreamWriter openUtf8ForCreate()
new
Utf8OutputStreamWriter(openForWrite())
.public Utf8OutputStreamWriter openUtf8ForCreateAtomic()
new
Utf8OutputStreamWriter(openForCreateAtomic())
.public OutputStream openForCreateAtomic()
public OutputStream openForCreateAtomic(long lastModifiedTime)
lastModifiedTime
- modification time in millis, set on updated file; ignored if zeropublic abstract void delete()
public abstract boolean exists()
public abstract void renameTo(java.lang.String newName)
newName
- public abstract void moveTo(File destination)
public abstract long getLastModifiedTime()
public abstract long getSize()
public abstract void setLastModifiedTime(long time)
time
- time in millis (milliseconds since Jan 1, 1970 UTC)public abstract Directory getParent()