|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.stanbol.enhancer.servicesapi.helper.InMemoryBlob
public class InMemoryBlob
Holds the parsed data in an byte array. Parsed byte[] are NOT copied,
Strings are encoded as UTF-8 and InputStream are copied by using
IOUtils.toByteArray(InputStream).
The default mime-types (if null is parsed as mimeType) are for
Strings "text/plain" and in all other cases "application/octet-stream".
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_BINARY_MIMETYPE
|
static java.lang.String |
DEFAULT_TEXT_MIMETYPE
|
protected java.lang.String |
mimeType
|
protected java.util.Map<java.lang.String,java.lang.String> |
parameters
|
| Constructor Summary | |
|---|---|
|
InMemoryBlob(byte[] data,
java.lang.String mimeType)
Creates an instance for the parsed byte array. |
protected |
InMemoryBlob(byte[] data,
java.lang.String mimeType,
java.util.Map<java.lang.String,java.lang.String> parsedParameters)
Internally used constructor that allows to parse additional parameters as required to ensure setting the 'charset' in case initialisation was done by parsing a string |
|
InMemoryBlob(java.io.InputStream in,
java.lang.String mimeType)
Creates an instance for the parsed InputStream. |
|
InMemoryBlob(java.lang.String text,
java.lang.String mimeType)
Creates an InMemoryBlob for the parsed String. |
| Method Summary | |
|---|---|
long |
getContentLength()
The size of the Content in bytes or a negative value if not known |
java.lang.String |
getMimeType()
Getter for the mime-type of the content. |
java.util.Map<java.lang.String,java.lang.String> |
getParameter()
Additional parameters parsed with the mime-type. |
java.io.InputStream |
getStream()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_TEXT_MIMETYPE
public static final java.lang.String DEFAULT_BINARY_MIMETYPE
protected final java.lang.String mimeType
protected final java.util.Map<java.lang.String,java.lang.String> parameters
| Constructor Detail |
|---|
public InMemoryBlob(java.lang.String text,
java.lang.String mimeType)
InMemoryBlob for the parsed String. If a "charset"
parameter is present for the parsed mimeType it is replaced with "UTF-8"
used to encode the Sting as byte[].
text - the textmimeType - the mimeType. If null "text/plain" is used
as default
public InMemoryBlob(java.io.InputStream in,
java.lang.String mimeType)
throws java.io.IOException
InputStream. Data are copied
to a byte array. The parsed stream is closed after copying the data.
in - the InputStream. MUST NOT be nullmimeType - the mime-type. If null "application/octet-stream"
is used as default.
java.io.IOException - indicates an error while reading from the parsed stream
public InMemoryBlob(byte[] data,
java.lang.String mimeType)
data - the data. MIST NOT be nullmimeType - the mime-type. If null "application/octet-stream"
is used as default.
protected InMemoryBlob(byte[] data,
java.lang.String mimeType,
java.util.Map<java.lang.String,java.lang.String> parsedParameters)
data - mimeType - parsedParameters - | Method Detail |
|---|
public final java.io.InputStream getStream()
getStream in interface Blobpublic final long getContentLength()
Blob
getContentLength in interface Blobpublic final java.lang.String getMimeType()
Blob
getMimeType in interface Blobpublic final java.util.Map<java.lang.String,java.lang.String> getParameter()
Blob
getParameter in interface Blob
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||