private boolean readHeader(SeekableStream fis, long fileOffset, boolean isLowToHigh) {

        LittleEndianInputStream lbdis;
        DataInputStream bdis;

         byte[] buffer = new byte[BPTREE_HEADER_SIZE];
         int bytesRead;
    
        try {
            // Read B+ tree header into a buffer
            fis.seek(fileOffset);
            fis.readFully(buffer);
        
            // decode header
            if(isLowToHigh){
                lbdis = new LittleEndianInputStream(new ByteArrayInputStream(buffer));

                // check for a valid B+ Tree Header
                magic = lbdis.readInt();

                if(magic != BPTREE_MAGIC_LTH)
                    return false;

                // Get mChromosome B+ header information
                blockSize = lbdis.readInt();
                keySize = lbdis.readInt();
                valSize = lbdis.readInt();
                itemCount = lbdis.readLong();
                reserved = lbdis.readLong();
            }
            else {
                bdis = new DataInputStream(new ByteArrayInputStream(buffer));

                // check for a valid B+ Tree Header
                magic = bdis.readInt();

                if(magic != BPTREE_MAGIC_HTL)
                    return false;

                // Get mChromosome B+ header information
                blockSize = bdis.readInt();
                keySize = bdis.readInt();
                valSize = bdis.readInt();
                itemCount = bdis.readLong();
                reserved = bdis.readLong();

            }

        }catch(IOException ex) {
           log.error("Error reading B+ tree header " + ex);
           throw new RuntimeException("Error reading B+ tree header \n", ex);
            }

        // success
         return true;
    }