Class FileUtils
java.lang.Object
org.exoplatform.commons.file.resource.FileUtils
This is an utility class : File operation Created by The eXo Platform SAS
Author : eXoPlatform exo@exoplatform.com
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyToFile(InputStream in, File file) Writes bytes from the specified inputStream to output stream.static booleancreateNewFile(File file) Create new file.static booleanTests in privileged mode whether the file or directory denoted by this abstract pathname exists.static booleanCreates the directory in privileged mode.static byte[]readBytes(InputStream in) Reads bytes of data from the input stream into an array of bytes.static voidWrites bytes from byte array to output stream.
-
Method Details
-
createNewFile
Create new file.- Parameters:
file- new file- Returns:
- boolean
- Throws:
IOException- Signals that an I/O exception of some sort has occurred.
-
exists
Tests in privileged mode whether the file or directory denoted by this abstract pathname exists.- Parameters:
file- file- Returns:
- boolean
-
mkdirs
Creates the directory in privileged mode.- Parameters:
file- new directory to create- Returns:
- boolean
-
readBytes
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
Writes bytes from the specified inputStream to output stream.- Parameters:
in- InputStreamfile- file- Throws:
IOException- signals that an I/O exception of some sort has occurred.
-
writeFile
Writes bytes from byte array to output stream.- Parameters:
file- filebuf- byte array- Throws:
IOException- signals that an I/O exception of some sort has occurred.
-