Class FileUtils

java.lang.Object
org.exoplatform.commons.file.resource.FileUtils

public final class FileUtils extends Object
This is an utility class : File operation Created by The eXo Platform SAS Author : eXoPlatform exo@exoplatform.com
  • Method Details

    • createNewFile

      public static boolean createNewFile(File file) throws IOException
      Create new file.
      Parameters:
      file - new file
      Returns:
      boolean
      Throws:
      IOException - Signals that an I/O exception of some sort has occurred.
    • exists

      public static boolean exists(File file)
      Tests in privileged mode whether the file or directory denoted by this abstract pathname exists.
      Parameters:
      file - file
      Returns:
      boolean
    • mkdirs

      public static boolean mkdirs(File file)
      Creates the directory in privileged mode.
      Parameters:
      file - new directory to create
      Returns:
      boolean
    • readBytes

      public static byte[] readBytes(InputStream in) throws IOException
      Reads bytes of data from the input stream into an array of bytes.
      Parameters:
      in - InputStream
      Returns:
      byte array
      Throws:
      IOException - signals that an I/O exception of some sort has occurred.
    • copyToFile

      public static void copyToFile(InputStream in, File file) throws IOException
      Writes bytes from the specified inputStream to output stream.
      Parameters:
      in - InputStream
      file - file
      Throws:
      IOException - signals that an I/O exception of some sort has occurred.
    • writeFile

      public static void writeFile(File file, byte[] buf) throws IOException
      Writes bytes from byte array to output stream.
      Parameters:
      file - file
      buf - byte array
      Throws:
      IOException - signals that an I/O exception of some sort has occurred.