public final class IOUtil extends Object
IOUtil provides utility methods used for import and export
operations.| Modifier and Type | Field and Description |
|---|---|
static long |
UNDEFINED_LENGTH
Constant for undefined content length
|
static long |
UNDEFINED_TIME
Constant for undefined modification/creation time
|
| Modifier and Type | Method and Description |
|---|---|
static String |
buildContentType(String mimeType,
String encoding)
Build a valid content type string from the given mimeType and encoding:
|
static String |
getCreated(long createdTime)
Return the creation time as formatted string.
|
static String |
getEncoding(String contentType)
Retrieve the encoding from the specified contentType.
|
static String |
getLastModified(long modificationTime)
Return the last modification time as formatted string.
|
static String |
getMimeType(String contentType)
Retrieve the mimeType from the specified contentType.
|
static File |
getTempFile(InputStream inputStream)
Builds a new temp.
|
static Node |
mkDirs(Node root,
String relPath,
String dirNodeType)
Recursively creates nodes below the specified root node.
|
static void |
spool(InputStream in,
OutputStream out) |
public static final long UNDEFINED_TIME
public static final long UNDEFINED_LENGTH
public static String getLastModified(long modificationTime)
HttpDateFormat.modificationDateFormat()public static String getCreated(long createdTime)
HttpDateFormat.creationDateFormat()public static void spool(InputStream in, OutputStream out) throws IOException
IOExceptionpublic static String buildContentType(String mimeType, String encoding)
<mimeType>; charset="<encoding>"If the specified mimeType is
null, null is returned.mimeType - encoding - null if the specified mimeType is
nullpublic static String getMimeType(String contentType)
contentType - nullpublic static String getEncoding(String contentType)
contentType - null if the specified contentType is
null or does not define a charset.public static File getTempFile(InputStream inputStream) throws IOException
It is left to the user to remove the file as soon as it is not used any more.
inputStream - the input streamnull if the specified input is
null.IOExceptionpublic static Node mkDirs(Node root, String relPath, String dirNodeType) throws RepositoryException
root - relPath - RepositoryExceptionCopyright © 2004–2022 The Apache Software Foundation. All rights reserved.