@InterfaceStability.Uncommitted @InterfaceAudience.Public public class ByteArrayDocument extends AbstractDocument<byte[]> implements Serializable
Handles a byte array as the document value.
This document differs from BinaryDocument
in that there is no manual refcounting needed on the underlying buffers. As a result, it is much safer to work with than the traditional BinaryDocument
and should be preferred as a result. Note that the cost is a single byte array copy from the buffer, so if this is still too much then the BinaryDocument
should be used as a last resort.
Modifier and Type | Method and Description |
---|---|
static ByteArrayDocument |
create(String id)
Creates a
ByteArrayDocument which the document id. |
static ByteArrayDocument |
create(String id,
byte[] content)
Creates a
ByteArrayDocument which the document id and content. |
static ByteArrayDocument |
create(String id,
byte[] content,
long cas)
Creates a
ByteArrayDocument which the document id, content and the CAS value. |
static ByteArrayDocument |
create(String id,
int expiry,
byte[] content)
Creates a
ByteArrayDocument which the document id, content and the expiration time. |
static ByteArrayDocument |
create(String id,
int expiry,
byte[] content,
long cas)
Creates a
ByteArrayDocument which the document id, content, CAS value, expiration time and status code. |
static ByteArrayDocument |
create(String id,
int expiry,
byte[] content,
long cas,
MutationToken mutationToken)
Creates a
ByteArrayDocument which the document id, content, CAS value, expiration time and status code. |
static ByteArrayDocument |
from(ByteArrayDocument doc,
long cas)
Creates a copy from a different
ByteArrayDocument , but changes the CAS value. |
static ByteArrayDocument |
from(ByteArrayDocument doc,
String id,
byte[] content)
Creates a copy from a different
ByteArrayDocument , but changes the document ID and content. |
cas, content, equals, expiry, hashCode, id, mutationToken, readFromSerializedStream, toString, writeToSerializedStream
public static ByteArrayDocument create(String id)
Creates a ByteArrayDocument
which the document id.
id
- the per-bucket unique document id.ByteArrayDocument
.public static ByteArrayDocument create(String id, byte[] content)
Creates a ByteArrayDocument
which the document id and content.
id
- the per-bucket unique document id.content
- the content of the document.ByteArrayDocument
.public static ByteArrayDocument create(String id, byte[] content, long cas)
Creates a ByteArrayDocument
which the document id, content and the CAS value.
id
- the per-bucket unique document id.content
- the content of the document.cas
- the CAS (compare and swap) value for optimistic concurrency.ByteArrayDocument
.public static ByteArrayDocument create(String id, int expiry, byte[] content)
Creates a ByteArrayDocument
which the document id, content and the expiration time.
id
- the per-bucket unique document id.content
- the content of the document.expiry
- the expiration time of the document.ByteArrayDocument
.public static ByteArrayDocument create(String id, int expiry, byte[] content, long cas)
Creates a ByteArrayDocument
which the document id, content, CAS value, expiration time and status code.
This factory method is normally only called within the client library when a response is analyzed and a document is returned which is enriched with the status code. It does not make sense to pre populate the status field from the user level code.
id
- the per-bucket unique document id.content
- the content of the document.cas
- the CAS (compare and swap) value for optimistic concurrency.expiry
- the expiration time of the document.ByteArrayDocument
.public static ByteArrayDocument create(String id, int expiry, byte[] content, long cas, MutationToken mutationToken)
Creates a ByteArrayDocument
which the document id, content, CAS value, expiration time and status code.
This factory method is normally only called within the client library when a response is analyzed and a document is returned which is enriched with the status code. It does not make sense to pre populate the status field from the user level code.
id
- the per-bucket unique document id.content
- the content of the document.cas
- the CAS (compare and swap) value for optimistic concurrency.expiry
- the expiration time of the document.ByteArrayDocument
.public static ByteArrayDocument from(ByteArrayDocument doc, String id, byte[] content)
Creates a copy from a different ByteArrayDocument
, but changes the document ID and content.
doc
- the original ByteArrayDocument
to copy.id
- the per-bucket unique document id.content
- the content of the document.ByteArrayDocument
with the changed properties.public static ByteArrayDocument from(ByteArrayDocument doc, long cas)
Creates a copy from a different ByteArrayDocument
, but changes the CAS value.
doc
- the original ByteArrayDocument
to copy.cas
- the CAS (compare and swap) value for optimistic concurrency.ByteArrayDocument
with the changed properties.Copyright © 2015 Couchbase, Inc.