public final class ContentStreamUtils extends Object
ContentStream
objects.Modifier and Type | Class and Description |
---|---|
static class |
ContentStreamUtils.AutoCloseInputStream
InputStream that gets closed when the end of the stream is reached or the
underlying stream throws an exception.
|
Modifier and Type | Method and Description |
---|---|
static MutableContentStream |
createByteArrayContentStream(String filename,
byte[] contentBytes)
Creates a content stream object from a byte array.
|
static MutableContentStream |
createByteArrayContentStream(String filename,
byte[] contentBytes,
int offset,
int length,
String mimetype)
Creates a content stream object from a byte array.
|
static MutableContentStream |
createByteArrayContentStream(String filename,
byte[] contentBytes,
String mimetype)
Creates a content stream object from a byte array.
|
static MutableContentStream |
createContentStream(String filename,
BigInteger length,
String mimetype,
InputStream stream)
Creates a content stream object for an InputStream.
|
static MutableContentStream |
createContentStream(String filename,
long length,
String mimetype,
InputStream stream)
Creates a content stream object for an InputStream.
|
static MutableContentStream |
createFileContentStream(File file)
Creates a content stream object from file.
|
static MutableContentStream |
createFileContentStream(File file,
String mimetype)
Creates a content stream object from file.
|
static MutableContentStream |
createFileContentStream(String filename,
File file)
Creates a content stream object from file.
|
static MutableContentStream |
createFileContentStream(String filename,
File file,
String mimetype)
Creates a content stream object from file.
|
static MutableContentStream |
createTextContentStream(String filename,
String content)
Creates a content stream object from a string.
|
static MutableContentStream |
createTextContentStream(String filename,
String content,
String mimetype)
Creates a content stream object from a string.
|
public static MutableContentStream createContentStream(String filename, long length, String mimetype, InputStream stream)
filename
- name of the content streamlength
- length of the stream in bytesmimetype
- content MIME typestream
- the InputStreamMutableContentStream
objectpublic static MutableContentStream createContentStream(String filename, BigInteger length, String mimetype, InputStream stream)
filename
- name of the content streamlength
- length of the stream in bytesmimetype
- content MIME typestream
- the InputStreamMutableContentStream
objectpublic static MutableContentStream createByteArrayContentStream(String filename, byte[] contentBytes)
filename
- name of the content streamcontentBytes
- content bytesMutableContentStream
objectpublic static MutableContentStream createByteArrayContentStream(String filename, byte[] contentBytes, String mimetype)
filename
- name of the content streamcontentBytes
- the content bytesmimetype
- content MIME typeMutableContentStream
objectpublic static MutableContentStream createByteArrayContentStream(String filename, byte[] contentBytes, int offset, int length, String mimetype)
filename
- name of the content streamcontentBytes
- the content bytesoffset
- the offset in the content byteslength
- the maximum number of bytes to read from the content bytesmimetype
- content MIME typeMutableContentStream
objectpublic static MutableContentStream createTextContentStream(String filename, String content)
filename
- name of the content streamcontent
- the content stringMutableContentStream
objectpublic static MutableContentStream createTextContentStream(String filename, String content, String mimetype)
filename
- name of the content streamcontent
- the content stringmimetype
- content MIME typeMutableContentStream
objectpublic static MutableContentStream createFileContentStream(File file) throws FileNotFoundException
file
- the fileMutableContentStream
objectFileNotFoundException
public static MutableContentStream createFileContentStream(String filename, File file) throws FileNotFoundException
filename
- name of the content streamfile
- the fileMutableContentStream
objectFileNotFoundException
public static MutableContentStream createFileContentStream(File file, String mimetype) throws FileNotFoundException
file
- the filemimetype
- content MIME typeMutableContentStream
objectFileNotFoundException
public static MutableContentStream createFileContentStream(String filename, File file, String mimetype) throws FileNotFoundException
filename
- name of the content streamfile
- the filemimetype
- content MIME typeMutableContentStream
objectFileNotFoundException
Copyright © 2009–2016 The Apache Software Foundation. All rights reserved.