public class ContentUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE |
| Constructor and Description |
|---|
ContentUtils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
convertToByteArray(InputStream inputStream)
Convert an input stream to a byte array
|
static int |
copy(InputStream in,
OutputStream out)
Helper method to copy from one stream to another
|
static void |
copyContentToFile(Content content,
File file)
Copy the content into a given file.
|
static InputStream |
getContentAsInputStream(Content content)
Get the content as an imput stream
|
static String |
getContentAsString(Content content)
Get the content from the download servlet as a string
|
static String |
putContent(File file)
Streams content into the repository.
|
static String |
putContent(File file,
String host,
int port)
Streams content into the repository.
|
static String |
putContent(File file,
String host,
int port,
String mimetype,
String encoding)
Streams content into the repository.
|
static String |
putContent(File file,
String host,
int port,
String webAppName,
String mimetype,
String encoding)
Streams content into the repository using nonSSL connection.
|
static String |
putContent(File file,
String host,
int port,
String webAppName,
String mimetype,
String encoding,
boolean isSSL)
Streams content into the repository.
|
public static final int BUFFER_SIZE
public static byte[] convertToByteArray(InputStream inputStream) throws Exception
inputStream - the input streamExceptionpublic static String getContentAsString(Content content)
content - the content objectpublic static InputStream getContentAsInputStream(Content content)
content - public static String putContent(File file)
file - the file to stream into the repositorypublic static String putContent(File file, String host, int port)
file - the file to stream into the repositoryhost - the host name of the destination repositoryport - the port name of the destination repositorypublic static String putContent(File file, String host, int port, String mimetype, String encoding)
file - the file to stream into the repositoryhost - the host name of the destination repositoryport - the port name of the destination repositorymimetype - the mimetype of the file, ignored if nullencoding - the encoding of the file, ignored if nullpublic static String putContent(File file, String host, int port, String webAppName, String mimetype, String encoding)
file - the file to stream into the repositoryhost - the host name of the destination repositoryport - the port name of the destination repositorywebAppName - the name of the target web application (default 'alfresco')mimetype - the mimetype of the file, ignored if nullencoding - the encoding of the file, ignored if nullpublic static String putContent(File file, String host, int port, String webAppName, String mimetype, String encoding, boolean isSSL)
file - the file to stream into the repositoryhost - the host name of the destination repositoryport - the port name of the destination repositorywebAppName - the name of the target web application (default 'alfresco')mimetype - the mimetype of the file, ignored if nullencoding - the encoding of the file, ignored if nullisSSL - true if HTTPS protocol is usedpublic static void copyContentToFile(Content content, File file)
content - the content objectfile - the filepublic static int copy(InputStream in, OutputStream out) throws IOException
in - out - IOExceptionCopyright © 2005–2014 Alfresco Software. All rights reserved.