java.lang.Object | ||
↳ | org.springframework.http.converter.AbstractHttpMessageConverter<T> | |
↳ | org.springframework.http.converter.ByteArrayHttpMessageConverter |
Implementation of HttpMessageConverter
that can read and write byte arrays.
By default, this converter supports all media types (*/*
), and writes with a Content-Type
of application/octet-stream
. This can be overridden by setting the supportedMediaTypes
property.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.http.converter.AbstractHttpMessageConverter
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new instance of the
ByteArrayHttpMessageConverter . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Abstract template method that reads the actualy object.
| |||||||||||
Indicates whether the given class is supported by this converter.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the content length for the given type.
| |||||||||||
Abstract template method that writes the actual body.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.http.converter.AbstractHttpMessageConverter
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.http.converter.HttpMessageConverter
|
Creates a new instance of the ByteArrayHttpMessageConverter
.
Abstract template method that reads the actualy object. Invoked from read(Class extends T>, HttpInputMessage)
.
clazz | the type of object to return |
---|---|
inputMessage | the HTTP input message to read from |
IOException |
---|
Indicates whether the given class is supported by this converter.
clazz | the class to test for support |
---|
true
if supported; false
otherwise
Returns the content length for the given type.
By default, this returns null
, meaning that the content length is unknown.
Can be overridden in subclasses.
bytes | the type to return the content length for |
---|
null
if not known
Abstract template method that writes the actual body. Invoked from write(T, MediaType, HttpOutputMessage)
.
bytes | the object to write to the output message |
---|---|
outputMessage | the message to write to |
IOException |
---|