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
IOException
public 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
null
public static String getMimeType(String contentType)
contentType
- null
public 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
.IOException
public static Node mkDirs(Node root, String relPath, String dirNodeType) throws RepositoryException
root
- relPath
- RepositoryException
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.