Class SmallDocumentBlock

    • Method Detail

      • getBigBlockSize

        public int getBigBlockSize()
      • convert

        public static SmallDocumentBlock[] convert​(byte[] array,
                                                   int size)
        convert a single long array into an array of SmallDocumentBlock instances
        Parameters:
        array - the byte array to be converted
        size - the intended size of the array (which may be smaller)
        Returns:
        an array of SmallDocumentBlock instances, filled from the array
      • fill

        public static int fill​(List blocks,
                               int size)
        fill out a List of SmallDocumentBlocks so that it fully occupies a set of big blocks
        Parameters:
        blocks - the List to be filled out
        Returns:
        number of big blocks the list encompasses
      • extract

        public static List extract​(ListManagedBlock[] blocks,
                                   int size)
                            throws IOException
        create a list of SmallDocumentBlock's from raw data
        Parameters:
        blocks - the raw data containing the SmallDocumentBlock data
        Returns:
        a List of SmallDocumentBlock's extracted from the input
        Throws:
        IOException
      • read

        public static void read​(BlockWritable[] blocks,
                                byte[] buffer,
                                int offset)
        read data from an array of SmallDocumentBlocks
        Parameters:
        blocks - the blocks to read from
        buffer - the buffer to write the data into
        offset - the offset into the array of blocks to read from
      • calcSize

        public static int calcSize​(int size)
        Calculate the storage size of a set of SmallDocumentBlocks
        Parameters:
        size - number of SmallDocumentBlocks
        Returns:
        total size
      • writeBlocks

        public void writeBlocks​(OutputStream stream)
                         throws IOException
        Write the storage to an OutputStream
        Specified by:
        writeBlocks in interface BlockWritable
        Parameters:
        stream - the OutputStream to which the stored data should be written
        Throws:
        IOException - on problems writing to the specified stream