br.com.objectos.fs
public interface RegularFile extends PathName, InputStreamSource, ReadableFileChannelSource, ReaderSource, WritablePathName
This is only a façade. More specifically, the underlying object may or may not represent an actual regular file. For example, the file may have been deleted between the time an instance of this interface is obtained and the time a method in this interface is invoked.
This interface can be used as both the source and destination in methods from
the Copy, Read and Write classes.
| Modifier and Type | Method and Description |
|---|---|
<R,P> R |
acceptPathNameVisitor(PathNameVisitor<R,P> visitor,
P p)
Accept method used to implement the visitor pattern.
|
void |
delete()
Deletes this file.
|
boolean |
exists()
Returns
true if the pathname represented by this object exists. |
long |
getLastModifiedMillis()
Returns the last modification time in millis.
|
String |
getName()
Returns the name of this file.
|
Directory |
getParent()
Returns the parent of this object.
|
String |
getPath()
Returns the full path of this pathname.
|
boolean |
is(RegularFileIsOption attribute)
Tests if this file has the specified attribute.
|
InputStream |
openInputStream()
Returns a new input stream for reading from this file.
|
OutputStream |
openOutputStream()
Returns a new output stream, in append mode, for writing to this file.
|
FileChannel |
openReadAndWriteChannel()
Returns a new channel for reading from and writing to this file.
|
FileChannel |
openReadChannel()
Returns a new channel for reading from this file.
|
long |
size()
Returns the file size in number of bytes.
|
File |
toFile()
Returns a
File representation of this file. |
URI |
toUri()
Returns an
URI representation of this pathname. |
void |
truncate()
Truncates this file.
|
openReaderopenWriteChannel, openWritercompareTovoid delete()
throws IOException
IOException - if an I/O error occurslong getLastModifiedMillis()
throws IOException
IOException - if an I/O error occursString getName()
Directory getParent() throws NotFoundException
If this object represents a nonexistent pathname then its parent might also be nonexistent.
NotFoundException - if a parent for this object cannot be foundboolean is(RegularFileIsOption attribute) throws IOException
attribute - the attribute to check fortrue if this file has the specified attributeIOException - if an I/O error occursInputStream openInputStream() throws IOException
openInputStream in interface InputStreamSourceIOException - if an I/O error occursOutputStream openOutputStream() throws IOException
openOutputStream in interface OutputStreamSourceopenOutputStream in interface WritablePathNameIOException - if an I/O error occurstruncate()FileChannel openReadAndWriteChannel() throws IOException
The returned channel is open in read and write mode and its initial
position is 0L.
0LIOException - if an I/O error occursFileChannel openReadChannel() throws IOException
The returned channel is open in read-only mode and its initial position is
0L.
openReadChannel in interface ReadableFileChannelSource0LIOException - if an I/O error occurslong size()
throws IOException
IOException - if an I/O error occursFile toFile()
File representation of this file.File representation of this filevoid truncate()
throws IOException
IOException - if an I/O error occurs<R,P> R acceptPathNameVisitor(PathNameVisitor<R,P> visitor, P p) throws IOException
R - the result type of this operationP - the type of the additional objectvisitor - the visitor operating on this PathName instancep - additional object passed to the visitorIOException - if an I/O error occursboolean exists()
true if the pathname represented by this object exists.true if the pathname represented by this object existsString getPath()
Copyright © 2021–2022 Objectos Software LTDA. All rights reserved.