@Contract(threading=STATELESS) public class HttpByteArrayCacheEntrySerializer extends Object implements HttpCacheEntrySerializer<byte[]>
HttpCacheEntrySerializer
interface, which defines the contract for HTTP cache
entry serialization and deserialization. It also includes a default buffer size of 8192 bytes, which can be
overridden by specifying a different buffer size in the constructor.Modifier and Type | Field and Description |
---|---|
static HttpByteArrayCacheEntrySerializer |
INSTANCE
Default instance of
HttpByteArrayCacheEntrySerializer . |
Constructor and Description |
---|
HttpByteArrayCacheEntrySerializer()
Constructs a new instance of
HttpByteArrayCacheEntrySerializer with a default buffer size. |
HttpByteArrayCacheEntrySerializer(int bufferSize)
Constructs a HttpByteArrayCacheEntrySerializer with the specified buffer size.
|
Modifier and Type | Method and Description |
---|---|
HttpCacheStorageEntry |
deserialize(byte[] serializedObject)
Deserializes a byte array representation of an HTTP cache storage entry into an instance of
HttpCacheStorageEntry . |
protected InputStream |
makeByteArrayInputStream(byte[] bytes)
Deprecated.
Do not use.
|
protected org.apache.hc.core5.http.impl.io.AbstractMessageParser<org.apache.hc.core5.http.ClassicHttpResponse> |
makeHttpResponseParser()
Deprecated.
Do not use.
|
protected org.apache.hc.core5.http.impl.io.AbstractMessageWriter<SimpleHttpResponse> |
makeHttpResponseWriter(org.apache.hc.core5.http.io.SessionOutputBuffer outputBuffer)
Deprecated.
Do not use.
|
byte[] |
serialize(HttpCacheStorageEntry storageEntry)
Serializes an HttpCacheStorageEntry object into a byte array using an HTTP-like format.
|
public static final HttpByteArrayCacheEntrySerializer INSTANCE
HttpByteArrayCacheEntrySerializer
.public HttpByteArrayCacheEntrySerializer(int bufferSize)
bufferSize
- the buffer size to use for serialization and deserialization.public HttpByteArrayCacheEntrySerializer()
HttpByteArrayCacheEntrySerializer
with a default buffer size.DEFAULT_BUFFER_SIZE
public byte[] serialize(HttpCacheStorageEntry storageEntry) throws ResourceIOException
The metadata is encoded into HTTP pseudo-headers for storage.
serialize
in interface HttpCacheEntrySerializer<byte[]>
storageEntry
- the HttpCacheStorageEntry to serialize.ResourceIOException
- if there is an error during serialization.public HttpCacheStorageEntry deserialize(byte[] serializedObject) throws ResourceIOException
HttpCacheStorageEntry
.deserialize
in interface HttpCacheEntrySerializer<byte[]>
serializedObject
- the byte array representation of the HTTP cache storage entryResourceIOException
- if an error occurs during deserialization@Deprecated protected InputStream makeByteArrayInputStream(byte[] bytes)
@Deprecated protected org.apache.hc.core5.http.impl.io.AbstractMessageParser<org.apache.hc.core5.http.ClassicHttpResponse> makeHttpResponseParser()
@Deprecated protected org.apache.hc.core5.http.impl.io.AbstractMessageWriter<SimpleHttpResponse> makeHttpResponseWriter(org.apache.hc.core5.http.io.SessionOutputBuffer outputBuffer)
Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.