if ( !( entry instanceof LockableAttributesImpl ) )
buf.append( "# Entry: " ).append( id ).append( "\n#---------------------\n\n" ); if ( !LdifUtils.isLDIFSafe( dn ) )
    private void dump( File partitionDirectory, PrintWriter out ) throws Exception    {        if ( !partitionDirectory.exists() )        {            notifyErrorListener( "Partition directory " + partitionDirectory + " does not exist!" );            throw new ToolCommandException( "Partition directory " + partitionDirectory + " does not exist!" );        }        out.println( "# ========================================================================" );        out.println( "# ApacheDS Tools Version: " + getVersion() );        out.println( "# Partition Directory: " + partitionDirectory );        out.println( "# ========================================================================\n\n" );        String path = partitionDirectory.getPath() + File.separator + "master";        BaseRecordManager base = new BaseRecordManager( path );        base.disableTransactions();        CacheRecordManager recMan = new CacheRecordManager( base, new MRU( 1000 ) );        JdbmMasterTable master = new JdbmMasterTable( recMan );        AttributeType attributeType = bootstrapRegistries.getAttributeTypeRegistry().lookup( "apacheUpdn" );        JdbmIndex idIndex = new JdbmIndex( attributeType, partitionDirectory, 1000 );        out.println( "#---------------------" );        NamingEnumeration list = master.listTuples();        StringBuffer buf = new StringBuffer();        while ( list.hasMore() )        {            Tuple tuple = ( Tuple ) list.next();            BigInteger id = ( BigInteger ) tuple.getKey();            String dn = ( String ) idIndex.reverseLookup( id );            Attributes entry = ( Attributes ) tuple.getValue();            filterAttributes( dn, entry );            if ( !( entry instanceof LockableAttributesImpl ) )            {                Attributes tmp = entry;                entry = new LockableAttributesImpl();                NamingEnumeration attrs = tmp.getAll();                while ( attrs.hasMore() )                {                    Attribute attr = ( Attribute ) attrs.next();                    LockableAttributeImpl myattr = new LockableAttributeImpl( attr.getID() );                    entry.put( myattr );                    for ( int ii = 0; ii < attr.size(); ii++ )                    {                        Object value = attr.get(ii);                                                // Checking if the value is binary                        if ( value instanceof byte[] )                        {                        	// It is binary, so we have to encode it using Base64 before adding it                        	char[] encoded = Base64.encode( ( byte[] ) value );                        	                        	myattr.add( new String( encoded ) );                        	                        }                        else if ( value instanceof String )                        {                        	// It's a String but, we have to check if encoding isn't required                        	String str = (String) value;                        	if ( !LdifUtils.isLDIFSafe( str ) )                        	{                        		char[] encoded = Base64.encode( ( ( String ) value ).getBytes() );                        		                        		myattr.add( new String( encoded ) );                        	}                        	else                        	{                        		myattr.add( value );                        	}                        }                    }                }            }            buf.append( "# Entry: " ).append( id ).append( "\n#---------------------\n\n" );            buf.append( "dn: " ).append( dn ).append( "\n" ).append( entry );            if ( list.hasMore() )            {                buf.append( "\n\n#---------------------\n" );            }            out.print( buf.toString() );            out.flush();            buf.setLength( 0 );        }    }