Class ByteArrayDocument

  • All Implemented Interfaces:
    Document<byte[]>, Serializable

    @Uncommitted
    @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.
    Since:
    2.5.2
    Author:
    Michael Nitschinger
    See Also:
    Serialized Form
    • Method Detail

      • create

        public static ByteArrayDocument create​(String id,
                                               byte[] content,
                                               long cas)
        Creates a ByteArrayDocument which the document id, content and the CAS value.
        Parameters:
        id - the per-bucket unique document id.
        content - the content of the document.
        cas - the CAS (compare and swap) value for optimistic concurrency.
        Returns:
        a ByteArrayDocument.
      • create

        public static ByteArrayDocument create​(String id,
                                               int expiry,
                                               byte[] content)
        Creates a ByteArrayDocument which the document id, content and the expiration time.
        Parameters:
        id - the per-bucket unique document id.
        content - the content of the document.
        expiry - the expiration time of the document.
        Returns:
        a ByteArrayDocument.
      • create

        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.
        Parameters:
        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.
        Returns:
        a ByteArrayDocument.
      • create

        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.
        Parameters:
        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.
        Returns:
        a ByteArrayDocument.