Class AnjayBytesContext

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public final class AnjayBytesContext
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Bytes context which may be used to return bytes from read handlers in AnjayObject.
    • Constructor Summary

      Constructors 
      Constructor Description
      AnjayBytesContext​(com.avsystem.anjay.impl.NativeBytesContext context)
      Creates bytes context - it is not intended to be called by user.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void append​(byte[] array)
      Appends array of bytes to the context.
      void append​(byte[] array, int offset, int length)
      Appends part of the array of bytes to the context.
      void append​(java.nio.ByteBuffer buffer)
      Appends buffer to the context.
      void close()
      Closes the context.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AnjayBytesContext

        public AnjayBytesContext​(com.avsystem.anjay.impl.NativeBytesContext context)
        Creates bytes context - it is not intended to be called by user. Use AnjayOutputContext.retBytes(int) instead.
    • Method Detail

      • close

        public void close()
        Closes the context.
        Specified by:
        close in interface java.lang.AutoCloseable
      • append

        public void append​(java.nio.ByteBuffer buffer)
        Appends buffer to the context.
      • append

        public void append​(byte[] array,
                           int offset,
                           int length)
        Appends part of the array of bytes to the context.
        Parameters:
        array - Array of bytes.
        offset - Offset in array to start reading from.
        length - Length of the data to append.
      • append

        public void append​(byte[] array)
        Appends array of bytes to the context.
        Parameters:
        array - Array of bytes to append.