Class AnjayInputContext

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public final class AnjayInputContext
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Context from which values sent by LwM2M Server can be read.
    • Constructor Summary

      Constructors 
      Constructor Description
      AnjayInputContext​(com.avsystem.anjay.impl.NativeInputContextPointer pointer)
      Creates input context - it is not intended to be called by user.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the context - it is not intended to be called by user.
      byte[] getAllBytes()
      Reads all bytes from the RPC request content.
      boolean getBoolean()
      Reads a boolean value from the RPC request content.
      boolean getBytes​(java.nio.ByteBuffer out)
      Reads bytes chunk from the RPC request content.
      double getDouble()
      Reads a double value from the RPC request content.
      float getFloat()
      Reads a float value from the RPC request content.
      int getInt()
      Reads an integer from the RPC request content.
      long getLong()
      Reads a long integer from the RPC request content.
      Anjay.Objlnk getObjlnk()
      Reads an Object Link value from the RPC request content.
      java.lang.String getString()
      Reads a string from the RPC request content.
      • Methods inherited from class java.lang.Object

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

      • AnjayInputContext

        public AnjayInputContext​(com.avsystem.anjay.impl.NativeInputContextPointer pointer)
        Creates input context - it is not intended to be called by user.
    • Method Detail

      • close

        public void close()
        Closes the context - it is not intended to be called by user.
        Specified by:
        close in interface java.lang.AutoCloseable
      • getInt

        public int getInt()
                   throws AnjayException
        Reads an integer from the RPC request content.
        Returns:
        Value read.
        Throws:
        AnjayException - In case of failure.
      • getLong

        public long getLong()
                     throws AnjayException
        Reads a long integer from the RPC request content.
        Returns:
        Value read.
        Throws:
        AnjayException - In case of failure.
      • getFloat

        public float getFloat()
                       throws AnjayException
        Reads a float value from the RPC request content.
        Returns:
        Value read.
        Throws:
        AnjayException - In case of failure.
      • getDouble

        public double getDouble()
                         throws AnjayException
        Reads a double value from the RPC request content.
        Returns:
        Value read.
        Throws:
        AnjayException - In case of failure.
      • getBoolean

        public boolean getBoolean()
                           throws AnjayException
        Reads a boolean value from the RPC request content.
        Returns:
        Value read.
        Throws:
        AnjayException - In case of failure.
      • getString

        public java.lang.String getString()
                                   throws AnjayException
        Reads a string from the RPC request content.
        Returns:
        Value read.
        Throws:
        AnjayException - In case of failure.
      • getBytes

        public boolean getBytes​(java.nio.ByteBuffer out)
                         throws AnjayException
        Reads bytes chunk from the RPC request content. This function should be called until it returns true to read all bytes.
        Parameters:
        out - Buffer to read bytes to.
        Returns:
        true if all bytes have been read, false otherwise.
        Throws:
        AnjayException - In case of failure.
      • getAllBytes

        public byte[] getAllBytes()
                           throws AnjayException
        Reads all bytes from the RPC request content.
        Returns:
        Array of bytes.
        Throws:
        AnjayException - In case of failure.