Package org.apache.commons.io.input
Class Tailer.TailablePath
- java.lang.Object
-
- org.apache.commons.io.input.Tailer.TailablePath
-
- All Implemented Interfaces:
Tailer.Tailable
- Enclosing class:
- Tailer
private static final class Tailer.TailablePath extends java.lang.Object implements Tailer.Tailable
A tailable for a filePath
.
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.file.LinkOption[]
linkOptions
private java.nio.file.Path
path
-
Constructor Summary
Constructors Modifier Constructor Description private
TailablePath(java.nio.file.Path path, java.nio.file.LinkOption... linkOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.nio.file.Path
getPath()
Tailer.RandomAccessResourceBridge
getRandomAccess(java.lang.String mode)
Creates a random access file stream to read.boolean
isNewer(java.nio.file.attribute.FileTime fileTime)
Tests if this tailable is newer than the specifiedFileTime
.java.nio.file.attribute.FileTime
lastModifiedFileTime()
Gets the last modificationFileTime
.long
size()
Gets the size of this tailable.java.lang.String
toString()
-
-
-
Method Detail
-
getPath
java.nio.file.Path getPath()
-
getRandomAccess
public Tailer.RandomAccessResourceBridge getRandomAccess(java.lang.String mode) throws java.io.FileNotFoundException
Description copied from interface:Tailer.Tailable
Creates a random access file stream to read.- Specified by:
getRandomAccess
in interfaceTailer.Tailable
- Parameters:
mode
- the access mode, by default this is forRandomAccessFile
.- Returns:
- a random access file stream to read.
- Throws:
java.io.FileNotFoundException
- if the tailable object does not exist.
-
isNewer
public boolean isNewer(java.nio.file.attribute.FileTime fileTime) throws java.io.IOException
Description copied from interface:Tailer.Tailable
Tests if this tailable is newer than the specifiedFileTime
.- Specified by:
isNewer
in interfaceTailer.Tailable
- Parameters:
fileTime
- the file time reference.- Returns:
- true if the
File
exists and has been modified after the givenFileTime
. - Throws:
java.io.IOException
- if an I/O error occurs.
-
lastModifiedFileTime
public java.nio.file.attribute.FileTime lastModifiedFileTime() throws java.io.IOException
Description copied from interface:Tailer.Tailable
Gets the last modificationFileTime
.- Specified by:
lastModifiedFileTime
in interfaceTailer.Tailable
- Returns:
- See
Files.getLastModifiedTime(Path, LinkOption...)
. - Throws:
java.io.IOException
- if an I/O error occurs.
-
size
public long size() throws java.io.IOException
Description copied from interface:Tailer.Tailable
Gets the size of this tailable.- Specified by:
size
in interfaceTailer.Tailable
- Returns:
- The size, in bytes, of this tailable, or
0
if the file does not exist. Some operating systems may return0
for path names denoting system-dependent entities such as devices or pipes. - Throws:
java.io.IOException
- if an I/O error occurs.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-