mavibot/src/main/java/org/apache/directory/mavibot/btree/memory/BulkDataSorter.java [77:110]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void sort( File dataFile ) throws IOException
    {
        int i = 0;

        Tuple<K, V>[] arr = ( Tuple<K, V>[] ) Array.newInstance( Tuple.class, splitAfter );

        Tuple<K, V> t = null;

        DataInputStream in = new DataInputStream( new FileInputStream( dataFile ) );

        while ( ( t = readerWriter.readUnsortedTuple( in ) ) != null )
        {
            arr[i++] = t;

            if ( ( i % splitAfter ) == 0 )
            {
                i = 0;
                Arrays.sort( arr, tupleComparator );

                storeSortedData( arr );
            }
        }

        if ( i != 0 )
        {
            Tuple<K, V>[] tmp = ( Tuple<K, V>[] ) Array.newInstance( Tuple.class, i );
            System.arraycopy( arr, 0, tmp, 0, i );
            Arrays.sort( tmp, tupleComparator );

            storeSortedData( tmp );
        }

        sorted = true;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



mavibot/src/main/java/org/apache/directory/mavibot/btree/persisted/BulkDataSorter.java [77:110]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void sort( File dataFile ) throws IOException
    {
        int i = 0;

        Tuple<K, V>[] arr = ( Tuple<K, V>[] ) Array.newInstance( Tuple.class, splitAfter );

        Tuple<K, V> t = null;

        DataInputStream in = new DataInputStream( new FileInputStream( dataFile ) );

        while ( ( t = readerWriter.readUnsortedTuple( in ) ) != null )
        {
            arr[i++] = t;

            if ( ( i % splitAfter ) == 0 )
            {
                i = 0;
                Arrays.sort( arr, tupleComparator );

                storeSortedData( arr );
            }
        }

        if ( i != 0 )
        {
            Tuple<K, V>[] tmp = ( Tuple<K, V>[] ) Array.newInstance( Tuple.class, i );
            System.arraycopy( arr, 0, tmp, 0, i );
            Arrays.sort( tmp, tupleComparator );

            storeSortedData( tmp );
        }

        sorted = true;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



