public class FileUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static char |
DEFAULT_SUBSTITUTE |
static char |
NO_SUBSTITUTE |
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static long |
copyFile(java.io.File input,
java.io.OutputStream output)
Copy bytes from a
File to an OutputStream. |
static java.lang.String |
getFileExtension(java.lang.String fileName)
Returns the file extension of a filename.
|
static java.io.File |
getTempDir()
Returns the temporary directory.
|
static java.util.Map<java.lang.String,java.io.File> |
uploadFiles(com.technia.tvc.struts.action.ActionServlet servlet,
javax.servlet.http.HttpServletRequest request,
java.lang.String tempPath) |
static java.util.Map<java.lang.String,java.io.File> |
uploadFiles(com.technia.tvc.struts.action.ActionServlet servlet,
javax.servlet.http.HttpServletRequest request,
java.lang.String tempPath,
int threshold,
int maxSize,
boolean useUploadedFileName) |
static java.lang.String |
validate(java.lang.String fileName)
Validates a file name.
|
static java.lang.String |
validate(java.lang.String fileName,
char substitute)
Validates a file name.
|
static java.lang.String |
validatePath(java.lang.String path) |
static java.lang.String |
validatePath(java.lang.String path,
char substitute) |
public static final char DEFAULT_SUBSTITUTE
public static final char NO_SUBSTITUTE
public static java.io.File getTempDir()
This method will first try to get the temp dir through
TVCSystem.getTempDir().
If that method returns null for some reason, then we will get the
java.io.tmpdir property.
I doub't that the latter method ever would return null, but if it does,
this method returns null.
public static java.lang.String validate(java.lang.String fileName)
fileName - Validate the file name.public static java.lang.String validate(java.lang.String fileName,
char substitute)
fileName - Validate the file name.public static java.lang.String validatePath(java.lang.String path)
path - A path to validate.public static java.lang.String validatePath(java.lang.String path,
char substitute)
path - A path to validate.public static java.util.Map<java.lang.String,java.io.File> uploadFiles(com.technia.tvc.struts.action.ActionServlet servlet,
javax.servlet.http.HttpServletRequest request,
java.lang.String tempPath)
throws java.lang.Exception
java.lang.Exceptionpublic static java.util.Map<java.lang.String,java.io.File> uploadFiles(com.technia.tvc.struts.action.ActionServlet servlet,
javax.servlet.http.HttpServletRequest request,
java.lang.String tempPath,
int threshold,
int maxSize,
boolean useUploadedFileName)
throws java.lang.Exception
java.lang.Exceptionpublic static java.lang.String getFileExtension(java.lang.String fileName)
fileName - The filenamepublic static long copyFile(java.io.File input,
java.io.OutputStream output)
throws java.io.IOException
File to an OutputStream.
This method buffers the input internally, so there is no need to use a
BufferedInputStream.
input - the File to read fromoutput - the OutputStream to write tojava.lang.NullPointerException - if the input or output is nulljava.io.IOException - if an I/O error occursCopyright ? Technia AB. All Rights Reserved.