public final class ByteArrayContent extends Object implements FileContent
FileContent
based on an byte array.Modifier and Type | Field and Description |
---|---|
String |
baseName
The basename returned by
getName() . |
byte[] |
bytes
The underlying byte array.
|
String |
contentType
The content type returned by
getContentType() . |
Constructor and Description |
---|
ByteArrayContent(byte[] bytes)
Equivalent to
this(bytes, null, null) . |
ByteArrayContent(byte[] bytes,
String contentType)
Equivalent to
this(bytes, contentType, null) . |
ByteArrayContent(byte[] bytes,
String contentType,
String baseName)
Constructs a file content object based on specified byte array.
|
Modifier and Type | Method and Description |
---|---|
String |
getContentType()
Returns the content type of this file content object.
|
InputStream |
getInputStream()
Returns an input stream allowing the read the contents of
this file content object.
|
String |
getName()
Returns the basename of this file content object.
|
long |
getSize()
Returns the size in bytes of this file content object.
|
public final byte[] bytes
public final String contentType
getContentType()
.
May be null
.public ByteArrayContent(byte[] bytes)
this(bytes, null, null)
.public ByteArrayContent(byte[] bytes, String contentType)
this(bytes, contentType, null)
.public ByteArrayContent(byte[] bytes, String contentType, String baseName)
bytes
- the underlying byte arraycontentType
- the content type associated to the contents
of the byte array. May be null
.baseName
- a basename for the contents of the byte array.
May be null
.public String getName()
FileContent
null
if not applicable.getName
in interface FileContent
public String getContentType()
FileContent
null
if unknown.getContentType
in interface FileContent
public long getSize()
FileContent
getSize
in interface FileContent
public InputStream getInputStream()
FileContent
getInputStream
in interface FileContent