Package com.xmlmind.netutil
Class ByteArrayContent
- java.lang.Object
- 
- com.xmlmind.netutil.ByteArrayContent
 
- 
- All Implemented Interfaces:
- FileContent
 
 public final class ByteArrayContent extends Object implements FileContent Implementation ofFileContentbased on an byte array.
- 
- 
Field SummaryFields Modifier and Type Field Description StringbaseNameThe basename returned bygetName().byte[]bytesThe underlying byte array.StringcontentTypeThe content type returned bygetContentType().
 - 
Constructor SummaryConstructors Constructor Description ByteArrayContent(byte[] bytes)Equivalent tothis(bytes, null, null).ByteArrayContent(byte[] bytes, String contentType)Equivalent tothis(bytes, contentType, null).ByteArrayContent(byte[] bytes, String contentType, String baseName)Constructs a file content object based on specified byte array.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContentType()Returns the content type of this file content object.InputStreamgetInputStream()Returns an input stream allowing the read the contents of this file content object.StringgetName()Returns the basename of this file content object.longgetSize()Returns the size in bytes of this file content object.
 
- 
- 
- 
Field Detail- 
bytespublic final byte[] bytes The underlying byte array.
 - 
contentTypepublic final String contentType The content type returned bygetContentType(). May benull.
 
- 
 - 
Constructor Detail- 
ByteArrayContentpublic ByteArrayContent(byte[] bytes) Equivalent tothis(bytes, null, null).
 - 
ByteArrayContentpublic ByteArrayContent(byte[] bytes, String contentType)Equivalent tothis(bytes, contentType, null).
 - 
ByteArrayContentpublic ByteArrayContent(byte[] bytes, String contentType, String baseName)Constructs a file content object based on specified byte array.- Parameters:
- bytes- the underlying byte array
- contentType- 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.
 
 
- 
 - 
Method Detail- 
getNamepublic String getName() Description copied from interface:FileContentReturns the basename of this file content object. May returnnullif not applicable.- Specified by:
- getNamein interface- FileContent
 
 - 
getContentTypepublic String getContentType() Description copied from interface:FileContentReturns the content type of this file content object. May returnnullif unknown.- Specified by:
- getContentTypein interface- FileContent
 
 - 
getSizepublic long getSize() Description copied from interface:FileContentReturns the size in bytes of this file content object.- Specified by:
- getSizein interface- FileContent
 
 - 
getInputStreampublic InputStream getInputStream() Description copied from interface:FileContentReturns an input stream allowing the read the contents of this file content object.- Specified by:
- getInputStreamin interface- FileContent
 
 
- 
 
-