Class StreamObject

    • Constructor Detail

      • StreamObject

        protected StreamObject​(StreamObjectTypeHeaderStart streamObjectType)
        Initializes a new instance of the StreamObject class.
        Parameters:
        streamObjectType - The instance of StreamObjectTypeHeaderStart.
    • Method Detail

      • getCurrent

        public static <T extends StreamObject> T getCurrent​(byte[] byteArray,
                                                            AtomicInteger index,
                                                            Class<T> clazz)
                                                     throws org.apache.tika.exception.TikaException,
                                                            IOException
        Get current stream object.
        Parameters:
        byteArray - The byte array which contains message.
        index - The position where to start.
        Returns:
        The current object instance.
        Throws:
        org.apache.tika.exception.TikaException
        IOException
      • parseStreamObject

        public static StreamObject parseStreamObject​(StreamObjectHeaderStart header,
                                                     byte[] byteArray,
                                                     AtomicInteger index)
                                              throws IOException,
                                                     org.apache.tika.exception.TikaException
        Parse stream object from byte array.
        Parameters:
        header - The instance of StreamObjectHeaderStart.
        byteArray - The byte array.
        index - The position where to start.
        Returns:
        The instance of StreamObject.
        Throws:
        IOException
        org.apache.tika.exception.TikaException
      • tryGetCurrent

        public static <T extends StreamObject> boolean tryGetCurrent​(byte[] byteArray,
                                                                     AtomicInteger index,
                                                                     AtomicReference<T> streamObject,
                                                                     Class<T> clazz)
                                                              throws org.apache.tika.exception.TikaException,
                                                                     IOException
        Try to get current object, true will returned if success.
        Parameters:
        byteArray - The byte array.
        index - The position where to start.
        streamObject - The instance that want to get.
        Returns:
        The result of whether get success.
        Throws:
        org.apache.tika.exception.TikaException
        IOException
      • deserializeFromByteArray

        public int deserializeFromByteArray​(StreamObjectHeaderStart header,
                                            byte[] byteArray,
                                            int startIndex)
                                     throws IOException,
                                            org.apache.tika.exception.TikaException
        Used to return the length of this element.
        Parameters:
        header - Then instance of StreamObjectHeaderStart.
        byteArray - The byte list
        startIndex - The position where to start.
        Returns:
        The element length
        Throws:
        IOException
        org.apache.tika.exception.TikaException
      • serializeItemsToByteList

        protected abstract int serializeItemsToByteList​(List<Byte> byteList)
                                                 throws IOException,
                                                        org.apache.tika.exception.TikaException
        Serialize items to byte list.
        Parameters:
        byteList - The byte list need to serialized.
        Returns:
        The length in bytes for additional data if the current stream object has, otherwise return 0.
        Throws:
        IOException
        org.apache.tika.exception.TikaException
      • deserializeItemsFromByteArray

        protected abstract void deserializeItemsFromByteArray​(byte[] byteArray,
                                                              AtomicInteger currentIndex,
                                                              int lengthOfItems)
                                                       throws org.apache.tika.exception.TikaException,
                                                              IOException
        De-serialize items from byte array.
        Parameters:
        byteArray - The byte array which contains response message.
        currentIndex - The index special where to start.
        lengthOfItems - The length of items.
        Throws:
        org.apache.tika.exception.TikaException
        IOException