Class FileImpl

Object
com.liferay.portal.util.FileImpl
All Implemented Interfaces:
com.liferay.portal.kernel.util.File

public class FileImpl extends Object implements com.liferay.portal.kernel.util.File
Author:
Brian Wing Shun Chan, Alexander Chow
  • Constructor Details

    • FileImpl

      public FileImpl()
  • Method Details

    • getInstance

      public static FileImpl getInstance()
    • appendParentheticalSuffix

      public String appendParentheticalSuffix(String fileName, String suffix)
      Specified by:
      appendParentheticalSuffix in interface com.liferay.portal.kernel.util.File
    • appendSuffix

      public String appendSuffix(String fileName, String suffix)
      Specified by:
      appendSuffix in interface com.liferay.portal.kernel.util.File
    • copyDirectory

      public void copyDirectory(File source, File destination) throws IOException
      Specified by:
      copyDirectory in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • copyDirectory

      public void copyDirectory(String sourceDirName, String destinationDirName) throws IOException
      Specified by:
      copyDirectory in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • copyFile

      public void copyFile(File source, File destination) throws IOException
      Specified by:
      copyFile in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • copyFile

      public void copyFile(String source, String destination) throws IOException
      Specified by:
      copyFile in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • createTempFile

      public File createTempFile()
      Specified by:
      createTempFile in interface com.liferay.portal.kernel.util.File
    • createTempFile

      public File createTempFile(byte[] bytes) throws IOException
      Specified by:
      createTempFile in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • createTempFile

      public File createTempFile(InputStream inputStream) throws IOException
      Specified by:
      createTempFile in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • createTempFile

      public File createTempFile(String extension)
      Specified by:
      createTempFile in interface com.liferay.portal.kernel.util.File
    • createTempFile

      public File createTempFile(String prefix, String extension)
      Specified by:
      createTempFile in interface com.liferay.portal.kernel.util.File
    • createTempFileName

      public String createTempFileName()
      Specified by:
      createTempFileName in interface com.liferay.portal.kernel.util.File
    • createTempFileName

      public String createTempFileName(String extension)
      Specified by:
      createTempFileName in interface com.liferay.portal.kernel.util.File
    • createTempFileName

      public String createTempFileName(String prefix, String extension)
      Specified by:
      createTempFileName in interface com.liferay.portal.kernel.util.File
    • createTempFolder

      public File createTempFolder() throws IOException
      Specified by:
      createTempFolder in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • decodeSafeFileName

      public String decodeSafeFileName(String fileName)
      Specified by:
      decodeSafeFileName in interface com.liferay.portal.kernel.util.File
    • delete

      public boolean delete(File file)
      Specified by:
      delete in interface com.liferay.portal.kernel.util.File
    • delete

      public boolean delete(String file)
      Specified by:
      delete in interface com.liferay.portal.kernel.util.File
    • deltree

      public void deltree(File directory)
      Specified by:
      deltree in interface com.liferay.portal.kernel.util.File
    • deltree

      public void deltree(String directory)
      Specified by:
      deltree in interface com.liferay.portal.kernel.util.File
    • encodeSafeFileName

      public String encodeSafeFileName(String fileName)
      Specified by:
      encodeSafeFileName in interface com.liferay.portal.kernel.util.File
    • exists

      public boolean exists(File file)
      Specified by:
      exists in interface com.liferay.portal.kernel.util.File
    • exists

      public boolean exists(String fileName)
      Specified by:
      exists in interface com.liferay.portal.kernel.util.File
    • getAbsolutePath

      public String getAbsolutePath(File file)
      Specified by:
      getAbsolutePath in interface com.liferay.portal.kernel.util.File
    • getBytes

      public byte[] getBytes(Class<?> clazz, String fileName) throws IOException
      Specified by:
      getBytes in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • getBytes

      public byte[] getBytes(File file) throws IOException
      Specified by:
      getBytes in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • getBytes

      public byte[] getBytes(InputStream inputStream) throws IOException
      Specified by:
      getBytes in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • getBytes

      public byte[] getBytes(InputStream inputStream, int bufferSize) throws IOException
      Specified by:
      getBytes in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • getBytes

      public byte[] getBytes(InputStream inputStream, int bufferSize, boolean cleanUpStream) throws IOException
      Specified by:
      getBytes in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • getExtension

      public String getExtension(String fileName)
      Specified by:
      getExtension in interface com.liferay.portal.kernel.util.File
    • getMD5Checksum

      public String getMD5Checksum(File file) throws IOException
      Specified by:
      getMD5Checksum in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • getPath

      public String getPath(String fullFileName)
      Specified by:
      getPath in interface com.liferay.portal.kernel.util.File
    • getShortFileName

      public String getShortFileName(String fullFileName)
      Specified by:
      getShortFileName in interface com.liferay.portal.kernel.util.File
    • isSameContent

      public boolean isSameContent(File file, byte[] bytes, int length)
      Specified by:
      isSameContent in interface com.liferay.portal.kernel.util.File
    • isSameContent

      public boolean isSameContent(File file, String s)
      Specified by:
      isSameContent in interface com.liferay.portal.kernel.util.File
    • listDirs

      public String[] listDirs(File file)
      Specified by:
      listDirs in interface com.liferay.portal.kernel.util.File
    • listDirs

      public String[] listDirs(String fileName)
      Specified by:
      listDirs in interface com.liferay.portal.kernel.util.File
    • listFiles

      public String[] listFiles(File file)
      Specified by:
      listFiles in interface com.liferay.portal.kernel.util.File
    • listFiles

      public String[] listFiles(String fileName)
      Specified by:
      listFiles in interface com.liferay.portal.kernel.util.File
    • mkdirs

      public void mkdirs(File file)
      Specified by:
      mkdirs in interface com.liferay.portal.kernel.util.File
    • mkdirs

      public void mkdirs(String pathName)
      Specified by:
      mkdirs in interface com.liferay.portal.kernel.util.File
    • move

      public boolean move(File source, File destination)
      Specified by:
      move in interface com.liferay.portal.kernel.util.File
    • move

      public boolean move(String sourceFileName, String destinationFileName)
      Specified by:
      move in interface com.liferay.portal.kernel.util.File
    • read

      public String read(File file) throws IOException
      Specified by:
      read in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • read

      public String read(File file, boolean raw) throws IOException
      Specified by:
      read in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • read

      public String read(String fileName) throws IOException
      Specified by:
      read in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • replaceSeparator

      public String replaceSeparator(String fileName)
      Specified by:
      replaceSeparator in interface com.liferay.portal.kernel.util.File
    • sortFiles

      public File[] sortFiles(File[] files)
      Specified by:
      sortFiles in interface com.liferay.portal.kernel.util.File
    • stripExtension

      public String stripExtension(String fileName)
      Specified by:
      stripExtension in interface com.liferay.portal.kernel.util.File
    • stripParentheticalSuffix

      public String stripParentheticalSuffix(String fileName)
      Specified by:
      stripParentheticalSuffix in interface com.liferay.portal.kernel.util.File
    • toList

      public List<String> toList(Reader reader)
      Specified by:
      toList in interface com.liferay.portal.kernel.util.File
    • toList

      public List<String> toList(String fileName)
      Specified by:
      toList in interface com.liferay.portal.kernel.util.File
    • toProperties

      public Properties toProperties(FileInputStream fileInputStream)
      Specified by:
      toProperties in interface com.liferay.portal.kernel.util.File
    • toProperties

      public Properties toProperties(String fileName)
      Specified by:
      toProperties in interface com.liferay.portal.kernel.util.File
    • touch

      public void touch(File file) throws IOException
      Specified by:
      touch in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • touch

      public void touch(String fileName) throws IOException
      Specified by:
      touch in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • unzip

      public void unzip(File source, File destination)
      Specified by:
      unzip in interface com.liferay.portal.kernel.util.File
    • write

      public void write(File file, byte[] bytes) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(File file, byte[] bytes, boolean append) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(File file, byte[] bytes, int offset, int length) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(File file, byte[] bytes, int offset, int length, boolean append) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(File file, InputStream inputStream) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(File file, String s) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(File file, String s, boolean lazy) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(File file, String s, boolean lazy, boolean append) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(String fileName, byte[] bytes) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(String fileName, InputStream inputStream) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(String fileName, String s) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(String fileName, String s, boolean lazy) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(String fileName, String s, boolean lazy, boolean append) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(String pathName, String fileName, String s) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(String pathName, String fileName, String s, boolean lazy) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • write

      public void write(String pathName, String fileName, String s, boolean lazy, boolean append) throws IOException
      Specified by:
      write in interface com.liferay.portal.kernel.util.File
      Throws:
      IOException
    • mkdirsParentFile

      protected void mkdirsParentFile(File file) throws IOException
      Throws:
      IOException