Class RegularFile

java.lang.Object
ecmwf.common.technical.GenericFile
ecmwf.common.technical.RegularFile

public final class RegularFile extends GenericFile
The Class RegularFile.
  • Method Details

    • supportsUnlinkWhileOpen

      public boolean supportsUnlinkWhileOpen()
      Whether the underlying filesystem supports POSIX unlink-while-open semantics
      Specified by:
      supportsUnlinkWhileOpen in class GenericFile
      Parameters:
      path - the path
      Returns:
      true, if supported unlink while open
    • renameTo

      public boolean renameTo(String path)
      Rename to.
      Specified by:
      renameTo in class GenericFile
      Parameters:
      path - the path
      Returns:
      true, if successful
    • getParent

      public String getParent()
      Gets the parent.
      Specified by:
      getParent in class GenericFile
      Returns:
      the parent
    • getName

      public String getName()
      Gets the name.
      Specified by:
      getName in class GenericFile
      Returns:
      the name
    • isDirectory

      public boolean isDirectory()
      Checks if is directory.
      Specified by:
      isDirectory in class GenericFile
      Returns:
      true, if is directory
    • isFile

      public boolean isFile()
      Checks if is file.
      Specified by:
      isFile in class GenericFile
      Returns:
      true, if is file
    • exists

      public boolean exists()
      Exists.
      Specified by:
      exists in class GenericFile
      Returns:
      true, if successful
    • getPath

      public String getPath()
      Gets the path.
      Specified by:
      getPath in class GenericFile
      Returns:
      the path
    • getAbsolutePath

      public String getAbsolutePath()
      Gets the absolute path.
      Specified by:
      getAbsolutePath in class GenericFile
      Returns:
      the absolute path
    • getParentFile

      public GenericFile getParentFile()
      Gets the parent file.
      Specified by:
      getParentFile in class GenericFile
      Returns:
      the parent file
    • delete

      public boolean delete()
      Delete.
      Specified by:
      delete in class GenericFile
      Returns:
      true, if successful
    • canRead

      public boolean canRead()
      Can read.
      Specified by:
      canRead in class GenericFile
      Returns:
      true, if successful
    • canWrite

      public boolean canWrite()
      Can write.
      Specified by:
      canWrite in class GenericFile
      Returns:
      true, if successful
    • length

      public long length()
      Length.
      Specified by:
      length in class GenericFile
      Returns:
      the long
    • lastModified

      public long lastModified() throws IOException
      Last modified.
      Specified by:
      lastModified in class GenericFile
      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:
      setLastModified in class GenericFile
      Parameters:
      time - the time
      Returns:
      true, if successful
    • setReadOnly

      public boolean setReadOnly()
      Sets the read only.
      Specified by:
      setReadOnly in class GenericFile
      Returns:
      true, if successful
    • getFileSystemId

      public String getFileSystemId() throws IOException
      Gets the underlying file system identifier.
      Specified by:
      getFileSystemId in class GenericFile
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getTotalSpace

      public long getTotalSpace()
      Gets the total space.
      Specified by:
      getTotalSpace in class GenericFile
      Returns:
      the total space
    • getFreeSpace

      public long getFreeSpace()
      Gets the free space.
      Specified by:
      getFreeSpace in class GenericFile
      Returns:
      the free space
    • mkdir

      public boolean mkdir()
      Mkdir.
      Specified by:
      mkdir in class GenericFile
      Returns:
      true, if successful
    • mkdirs

      public boolean mkdirs()
      Mkdirs.
      Specified by:
      mkdirs in class GenericFile
      Returns:
      true, if successful
    • list

      public String[] list(GenericFileFilter filter)
      List.
      Specified by:
      list in class GenericFile
      Parameters:
      filter - the filter
      Returns:
      the string[]
    • listFiles

      public GenericFile[] listFiles(GenericFileFilter filter) throws IOException
      List files.
      Specified by:
      listFiles in class GenericFile
      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:
      isAbsolute in class GenericFile
      Returns:
      true, if is absolute
    • getFile

      public File getFile() throws IOException
      Gets the file.
      Specified by:
      getFile in class GenericFile
      Returns:
      the file
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • list

      public String[] list()
      List.
      Specified by:
      list in class GenericFile
      Returns:
      the string[]
    • listCount

      public long listCount() throws IOException
      List count.
      Specified by:
      listCount in class GenericFile
      Returns:
      the long
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • listSize

      public long listSize() throws IOException
      List size.
      Specified by:
      listSize in class GenericFile
      Returns:
      the long
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • listFiles

      public GenericFile[] listFiles() throws IOException
      List files.
      Specified by:
      listFiles in class GenericFile
      Returns:
      the generic file[]
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getInputStream

      public InputStream getInputStream() throws FileNotFoundException
      Gets the input stream.
      Specified by:
      getInputStream in class GenericFile
      Returns:
      the input stream
      Throws:
      FileNotFoundException - the file not found exception
    • getOutputStream

      public OutputStream getOutputStream() throws FileNotFoundException
      Gets the output stream.
      Specified by:
      getOutputStream in class GenericFile
      Returns:
      the output stream
      Throws:
      FileNotFoundException - the file not found exception
    • getOutputStream

      public OutputStream getOutputStream(boolean append) throws FileNotFoundException
      Gets the output stream.
      Specified by:
      getOutputStream in class GenericFile
      Parameters:
      append - the append
      Returns:
      the output stream
      Throws:
      FileNotFoundException - the file not found exception
    • transmitFile

      public long transmitFile(OutputStream out, long offset) throws IOException
      Transmit file.
      Specified by:
      transmitFile in class GenericFile
      Parameters:
      out - the out
      offset - the offset
      Returns:
      the long
      Throws:
      FileNotFoundException - the file not found exception
      IOException - Signals that an I/O exception has occurred.
    • receiveFile

      public long receiveFile(InputStream in, long expectedBytesCount) throws IOException
      Receive file.
      Specified by:
      receiveFile in class GenericFile
      Parameters:
      in - the in
      expectedBytesCount - the expected bytes count
      Returns:
      the long
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • deleteIfExists

      public static boolean deleteIfExists(File file)
      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