Package com.lightcrafts.utils.file

Examples of com.lightcrafts.utils.file.FileIterator


     * Initialize by creating a set of all files in the cache, totaling their
     * sizes, and setting the cache's size to said total.
     */
    private void initialize() {
        long totalSize = 0;
        final FileIterator i = new FileIterator(
            m_owningCache.getCacheDirectory(), FileCacheFilter.INSTANCE, true
        );
        while ( i.hasNext() ) {
            if ( m_abortInitialize || m_stop )
                return;
            final File file = i.next();
            final long size = file.length();
            if ( size > 0 )
                try {
                    addFile( file );
                    totalSize += size;
View Full Code Here


    public static void main( String[] args ) throws Exception {
        final FileCache cache =
            new FileCache( TEST_CAPACITY, PerUserFileCacheKeyMapper.create() );

        for ( FileIterator i = new FileIterator( new File( args[0] ), false );
              i.hasNext(); ) {
            final File file = i.next();
            System.err.println( "main(): putting " + file.getAbsolutePath() + ", size = " + (file.length() / (1024*1024)) + " MB" );
            final FileInputStream fis = new FileInputStream( file );
            final FileChannel fic = fis.getChannel();
            final FileOutputStream fos = cache.putToStream( file.getAbsolutePath() );
            final FileChannel foc = fos.getChannel();
View Full Code Here

TOP

Related Classes of com.lightcrafts.utils.file.FileIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.