com.liferay.portal.util
Class FileImpl
java.lang.Object
com.liferay.portal.util.FileImpl
- All Implemented Interfaces:
- File
public class FileImpl
- extends Object
- implements File
|
Method Summary |
String |
appendParentheticalSuffix(String fileName,
String suffix)
|
String |
appendSuffix(String fileName,
String suffix)
|
void |
copyDirectory(File source,
File destination)
|
void |
copyDirectory(String sourceDirName,
String destinationDirName)
|
void |
copyFile(File source,
File destination)
|
void |
copyFile(File source,
File destination,
boolean lazy)
|
void |
copyFile(String source,
String destination)
|
void |
copyFile(String source,
String destination,
boolean lazy)
|
File |
createTempFile()
|
File |
createTempFile(byte[] bytes)
|
File |
createTempFile(InputStream is)
|
File |
createTempFile(String extension)
|
File |
createTempFile(String prefix,
String extension)
|
String |
createTempFileName()
|
String |
createTempFileName(String extension)
|
String |
createTempFileName(String prefix,
String extension)
|
File |
createTempFolder()
|
String |
decodeSafeFileName(String fileName)
|
boolean |
delete(File file)
|
boolean |
delete(String file)
|
void |
deltree(File directory)
|
void |
deltree(String directory)
|
String |
encodeSafeFileName(String fileName)
|
boolean |
exists(File file)
|
boolean |
exists(String fileName)
|
String |
extractText(InputStream is,
String fileName)
|
String |
extractText(InputStream is,
String fileName,
int maxStringLength)
|
String[] |
find(String directory,
String includes,
String excludes)
|
String |
getAbsolutePath(File file)
|
byte[] |
getBytes(Class<?> clazz,
String fileName)
|
byte[] |
getBytes(File file)
|
byte[] |
getBytes(InputStream is)
|
byte[] |
getBytes(InputStream inputStream,
int bufferSize)
|
byte[] |
getBytes(InputStream inputStream,
int bufferSize,
boolean cleanUpStream)
|
String |
getExtension(String fileName)
|
static FileImpl |
getInstance()
|
String |
getMD5Checksum(File file)
|
String |
getPath(String fullFileName)
|
String |
getShortFileName(String fullFileName)
|
boolean |
isAscii(File file)
|
boolean |
isSameContent(File file,
byte[] bytes,
int length)
|
boolean |
isSameContent(File file,
String s)
|
String[] |
listDirs(File file)
|
String[] |
listDirs(String fileName)
|
String[] |
listFiles(File file)
|
String[] |
listFiles(String fileName)
|
void |
mkdirs(File file)
|
void |
mkdirs(String pathName)
|
protected void |
mkdirsParentFile(File file)
|
boolean |
move(File source,
File destination)
|
boolean |
move(String sourceFileName,
String destinationFileName)
|
String |
read(File file)
|
String |
read(File file,
boolean raw)
|
String |
read(String fileName)
|
String |
replaceSeparator(String fileName)
|
File[] |
sortFiles(File[] files)
|
String |
stripExtension(String fileName)
|
String |
stripParentheticalSuffix(String fileName)
|
List<String> |
toList(Reader reader)
|
List<String> |
toList(String fileName)
|
Properties |
toProperties(FileInputStream fis)
|
Properties |
toProperties(String fileName)
|
void |
touch(File file)
|
void |
touch(String fileName)
|
void |
unzip(File source,
File destination)
|
void |
write(File file,
byte[] bytes)
|
void |
write(File file,
byte[] bytes,
boolean append)
|
void |
write(File file,
byte[] bytes,
int offset,
int length)
|
void |
write(File file,
byte[] bytes,
int offset,
int length,
boolean append)
|
void |
write(File file,
InputStream is)
|
void |
write(File file,
String s)
|
void |
write(File file,
String s,
boolean lazy)
|
void |
write(File file,
String s,
boolean lazy,
boolean append)
|
void |
write(String fileName,
byte[] bytes)
|
void |
write(String fileName,
InputStream is)
|
void |
write(String fileName,
String s)
|
void |
write(String fileName,
String s,
boolean lazy)
|
void |
write(String fileName,
String s,
boolean lazy,
boolean append)
|
void |
write(String pathName,
String fileName,
String s)
|
void |
write(String pathName,
String fileName,
String s,
boolean lazy)
|
void |
write(String pathName,
String fileName,
String s,
boolean lazy,
boolean append)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileImpl
public FileImpl()
getInstance
public static FileImpl getInstance()
appendParentheticalSuffix
public String appendParentheticalSuffix(String fileName,
String suffix)
- Specified by:
appendParentheticalSuffix in interface File
appendSuffix
public String appendSuffix(String fileName,
String suffix)
- Specified by:
appendSuffix in interface File
copyDirectory
public void copyDirectory(File source,
File destination)
throws IOException
- Specified by:
copyDirectory in interface File
- Throws:
IOException
copyDirectory
public void copyDirectory(String sourceDirName,
String destinationDirName)
throws IOException
- Specified by:
copyDirectory in interface File
- Throws:
IOException
copyFile
public void copyFile(File source,
File destination)
throws IOException
- Specified by:
copyFile in interface File
- Throws:
IOException
copyFile
public void copyFile(File source,
File destination,
boolean lazy)
throws IOException
- Specified by:
copyFile in interface File
- Throws:
IOException
copyFile
public void copyFile(String source,
String destination)
throws IOException
- Specified by:
copyFile in interface File
- Throws:
IOException
copyFile
public void copyFile(String source,
String destination,
boolean lazy)
throws IOException
- Specified by:
copyFile in interface File
- Throws:
IOException
createTempFile
public File createTempFile()
- Specified by:
createTempFile in interface File
createTempFile
public File createTempFile(byte[] bytes)
throws IOException
- Specified by:
createTempFile in interface File
- Throws:
IOException
createTempFile
public File createTempFile(InputStream is)
throws IOException
- Specified by:
createTempFile in interface File
- Throws:
IOException
createTempFile
public File createTempFile(String extension)
- Specified by:
createTempFile in interface File
createTempFile
public File createTempFile(String prefix,
String extension)
- Specified by:
createTempFile in interface File
createTempFileName
public String createTempFileName()
- Specified by:
createTempFileName in interface File
createTempFileName
public String createTempFileName(String extension)
- Specified by:
createTempFileName in interface File
createTempFileName
public String createTempFileName(String prefix,
String extension)
- Specified by:
createTempFileName in interface File
createTempFolder
public File createTempFolder()
throws IOException
- Specified by:
createTempFolder in interface File
- Throws:
IOException
decodeSafeFileName
public String decodeSafeFileName(String fileName)
- Specified by:
decodeSafeFileName in interface File
delete
public boolean delete(File file)
- Specified by:
delete in interface File
delete
public boolean delete(String file)
- Specified by:
delete in interface File
deltree
public void deltree(File directory)
- Specified by:
deltree in interface File
deltree
public void deltree(String directory)
- Specified by:
deltree in interface File
encodeSafeFileName
public String encodeSafeFileName(String fileName)
- Specified by:
encodeSafeFileName in interface File
exists
public boolean exists(File file)
- Specified by:
exists in interface File
exists
public boolean exists(String fileName)
- Specified by:
exists in interface File
extractText
public String extractText(InputStream is,
String fileName)
- Specified by:
extractText in interface File
extractText
public String extractText(InputStream is,
String fileName,
int maxStringLength)
- Specified by:
extractText in interface File
find
public String[] find(String directory,
String includes,
String excludes)
- Specified by:
find in interface File
getAbsolutePath
public String getAbsolutePath(File file)
- Specified by:
getAbsolutePath in interface File
getBytes
public byte[] getBytes(Class<?> clazz,
String fileName)
throws IOException
- Specified by:
getBytes in interface File
- Throws:
IOException
getBytes
public byte[] getBytes(File file)
throws IOException
- Specified by:
getBytes in interface File
- Throws:
IOException
getBytes
public byte[] getBytes(InputStream is)
throws IOException
- Specified by:
getBytes in interface File
- Throws:
IOException
getBytes
public byte[] getBytes(InputStream inputStream,
int bufferSize)
throws IOException
- Specified by:
getBytes in interface File
- Throws:
IOException
getBytes
public byte[] getBytes(InputStream inputStream,
int bufferSize,
boolean cleanUpStream)
throws IOException
- Specified by:
getBytes in interface File
- Throws:
IOException
getExtension
public String getExtension(String fileName)
- Specified by:
getExtension in interface File
getMD5Checksum
public String getMD5Checksum(File file)
throws IOException
- Specified by:
getMD5Checksum in interface File
- Throws:
IOException
getPath
public String getPath(String fullFileName)
- Specified by:
getPath in interface File
getShortFileName
public String getShortFileName(String fullFileName)
- Specified by:
getShortFileName in interface File
isAscii
public boolean isAscii(File file)
throws IOException
- Specified by:
isAscii in interface File
- Throws:
IOException
isSameContent
public boolean isSameContent(File file,
byte[] bytes,
int length)
- Specified by:
isSameContent in interface File
isSameContent
public boolean isSameContent(File file,
String s)
- Specified by:
isSameContent in interface File
listDirs
public String[] listDirs(File file)
- Specified by:
listDirs in interface File
listDirs
public String[] listDirs(String fileName)
- Specified by:
listDirs in interface File
listFiles
public String[] listFiles(File file)
- Specified by:
listFiles in interface File
listFiles
public String[] listFiles(String fileName)
- Specified by:
listFiles in interface File
mkdirs
public void mkdirs(File file)
throws IOException
- Specified by:
mkdirs in interface File
- Throws:
IOException
mkdirs
public void mkdirs(String pathName)
- Specified by:
mkdirs in interface File
move
public boolean move(File source,
File destination)
- Specified by:
move in interface File
move
public boolean move(String sourceFileName,
String destinationFileName)
- Specified by:
move in interface File
read
public String read(File file)
throws IOException
- Specified by:
read in interface File
- Throws:
IOException
read
public String read(File file,
boolean raw)
throws IOException
- Specified by:
read in interface File
- Throws:
IOException
read
public String read(String fileName)
throws IOException
- Specified by:
read in interface File
- Throws:
IOException
replaceSeparator
public String replaceSeparator(String fileName)
- Specified by:
replaceSeparator in interface File
sortFiles
public File[] sortFiles(File[] files)
- Specified by:
sortFiles in interface File
stripExtension
public String stripExtension(String fileName)
- Specified by:
stripExtension in interface File
stripParentheticalSuffix
public String stripParentheticalSuffix(String fileName)
- Specified by:
stripParentheticalSuffix in interface File
toList
public List<String> toList(Reader reader)
- Specified by:
toList in interface File
toList
public List<String> toList(String fileName)
- Specified by:
toList in interface File
toProperties
public Properties toProperties(FileInputStream fis)
- Specified by:
toProperties in interface File
toProperties
public Properties toProperties(String fileName)
- Specified by:
toProperties in interface File
touch
public void touch(File file)
throws IOException
- Specified by:
touch in interface File
- Throws:
IOException
touch
public void touch(String fileName)
throws IOException
- Specified by:
touch in interface File
- Throws:
IOException
unzip
public void unzip(File source,
File destination)
- Specified by:
unzip in interface File
write
public void write(File file,
byte[] bytes)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(File file,
byte[] bytes,
boolean append)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(File file,
byte[] bytes,
int offset,
int length)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(File file,
byte[] bytes,
int offset,
int length,
boolean append)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(File file,
InputStream is)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(File file,
String s)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(File file,
String s,
boolean lazy)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(File file,
String s,
boolean lazy,
boolean append)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(String fileName,
byte[] bytes)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(String fileName,
InputStream is)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(String fileName,
String s)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(String fileName,
String s,
boolean lazy)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(String fileName,
String s,
boolean lazy,
boolean append)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(String pathName,
String fileName,
String s)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(String pathName,
String fileName,
String s,
boolean lazy)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
write
public void write(String pathName,
String fileName,
String s,
boolean lazy,
boolean append)
throws IOException
- Specified by:
write in interface File
- Throws:
IOException
mkdirsParentFile
protected void mkdirsParentFile(File file)
throws IOException
- Throws:
IOException