Class RegularFile
java.lang.Object
ecmwf.common.technical.GenericFile
ecmwf.common.technical.RegularFile
The Class RegularFile.
-
Nested Class Summary
Nested classes/interfaces inherited from class GenericFile
GenericFile.IncorrectFileSize, GenericFile.IncorrectTransmittedSize, GenericFile.UnexpectedFileSize -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRead()Can read.booleancanWrite()Can write.booleandelete()Delete.static booleandeleteIfExists(File file) Attempts to delete a file using NIO, with detailed logging on failure.booleanexists()Exists.Gets the absolute path.getFile()Gets the file.Gets the underlying file system identifier.longGets the free space.Gets the input stream.getName()Gets the name.Gets the output stream.getOutputStream(boolean append) Gets the output stream.Gets the parent.Gets the parent file.getPath()Gets the path.longGets the total space.booleanChecks if is absolute.booleanChecks if is directory.booleanisFile()Checks if is file.longLast modified.longlength()Length.String[]list()List.String[]list(GenericFileFilter filter) List.longList count.List files.listFiles(GenericFileFilter filter) List files.longlistSize()List size.booleanmkdir()Mkdir.booleanmkdirs()Mkdirs.longreceiveFile(InputStream in, long expectedBytesCount) Receive file.booleanRename to.booleansetLastModified(long time) Sets the last modified.booleanSets the read only.booleanWhether the underlying filesystem supports POSIX unlink-while-open semanticslongtransmitFile(OutputStream out, long offset) Transmit file.Methods inherited from class GenericFile
delete, getGenericFile, getGenericFile, getGenericFile
-
Method Details
-
supportsUnlinkWhileOpen
public boolean supportsUnlinkWhileOpen()Whether the underlying filesystem supports POSIX unlink-while-open semantics- Specified by:
supportsUnlinkWhileOpenin classGenericFile- Parameters:
path- the path- Returns:
- true, if supported unlink while open
-
renameTo
Rename to.- Specified by:
renameToin classGenericFile- Parameters:
path- the path- Returns:
- true, if successful
-
getParent
Gets the parent.- Specified by:
getParentin classGenericFile- Returns:
- the parent
-
getName
-
isDirectory
public boolean isDirectory()Checks if is directory.- Specified by:
isDirectoryin classGenericFile- Returns:
- true, if is directory
-
isFile
public boolean isFile()Checks if is file.- Specified by:
isFilein classGenericFile- Returns:
- true, if is file
-
exists
public boolean exists()Exists.- Specified by:
existsin classGenericFile- Returns:
- true, if successful
-
getPath
-
getAbsolutePath
Gets the absolute path.- Specified by:
getAbsolutePathin classGenericFile- Returns:
- the absolute path
-
getParentFile
Gets the parent file.- Specified by:
getParentFilein classGenericFile- Returns:
- the parent file
-
delete
public boolean delete()Delete.- Specified by:
deletein classGenericFile- Returns:
- true, if successful
-
canRead
public boolean canRead()Can read.- Specified by:
canReadin classGenericFile- Returns:
- true, if successful
-
canWrite
public boolean canWrite()Can write.- Specified by:
canWritein classGenericFile- Returns:
- true, if successful
-
length
-
lastModified
Last modified.- Specified by:
lastModifiedin classGenericFile- Returns:
- the long
- Throws:
IOException- Signals that an I/O exception has occurred.
-
setLastModified
public boolean setLastModified(long time) Sets the last modified.- Specified by:
setLastModifiedin classGenericFile- Parameters:
time- the time- Returns:
- true, if successful
-
setReadOnly
public boolean setReadOnly()Sets the read only.- Specified by:
setReadOnlyin classGenericFile- Returns:
- true, if successful
-
getFileSystemId
Gets the underlying file system identifier.- Specified by:
getFileSystemIdin classGenericFile- Throws:
IOException- Signals that an I/O exception has occurred.
-
getTotalSpace
public long getTotalSpace()Gets the total space.- Specified by:
getTotalSpacein classGenericFile- Returns:
- the total space
-
getFreeSpace
public long getFreeSpace()Gets the free space.- Specified by:
getFreeSpacein classGenericFile- Returns:
- the free space
-
mkdir
-
mkdirs
public boolean mkdirs()Mkdirs.- Specified by:
mkdirsin classGenericFile- Returns:
- true, if successful
-
list
List.- Specified by:
listin classGenericFile- Parameters:
filter- the filter- Returns:
- the string[]
-
listFiles
List files.- Specified by:
listFilesin classGenericFile- Parameters:
filter- the filter- Returns:
- the generic file[]
- Throws:
IOException- Signals that an I/O exception has occurred.
-
isAbsolute
public boolean isAbsolute()Checks if is absolute.- Specified by:
isAbsolutein classGenericFile- Returns:
- true, if is absolute
-
getFile
Gets the file.- Specified by:
getFilein classGenericFile- Returns:
- the file
- Throws:
IOException- Signals that an I/O exception has occurred.
-
list
-
listCount
List count.- Specified by:
listCountin classGenericFile- Returns:
- the long
- Throws:
IOException- Signals that an I/O exception has occurred.
-
listSize
List size.- Specified by:
listSizein classGenericFile- Returns:
- the long
- Throws:
IOException- Signals that an I/O exception has occurred.
-
listFiles
List files.- Specified by:
listFilesin classGenericFile- Returns:
- the generic file[]
- Throws:
IOException- Signals that an I/O exception has occurred.
-
getInputStream
Gets the input stream.- Specified by:
getInputStreamin classGenericFile- Returns:
- the input stream
- Throws:
FileNotFoundException- the file not found exception
-
getOutputStream
Gets the output stream.- Specified by:
getOutputStreamin classGenericFile- Returns:
- the output stream
- Throws:
FileNotFoundException- the file not found exception
-
getOutputStream
Gets the output stream.- Specified by:
getOutputStreamin classGenericFile- Parameters:
append- the append- Returns:
- the output stream
- Throws:
FileNotFoundException- the file not found exception
-
transmitFile
Transmit file.- Specified by:
transmitFilein classGenericFile- Parameters:
out- the outoffset- the offset- Returns:
- the long
- Throws:
FileNotFoundException- the file not found exceptionIOException- Signals that an I/O exception has occurred.
-
receiveFile
Receive file.- Specified by:
receiveFilein classGenericFile- Parameters:
in- the inexpectedBytesCount- the expected bytes count- Returns:
- the long
- Throws:
IOException- Signals that an I/O exception has occurred.
-
deleteIfExists
Attempts to delete a file using NIO, with detailed logging on failure.- Parameters:
file- the file to delete- Returns:
- true if the file was successfully deleted or did not exist, false otherwise
-