Android Open Source - WineDB File Utils






From Project

Back to project page WineDB.

License

The source code is released under:

MIT License

If you think the Android project WineDB listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.selesse.android.winedb.database;
// w w w . ja v  a 2 s.com
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

public class FileUtils {
    /**
     * Creates the specified <code>toFile</code> as a byte for byte copy of the <code>fromFile</code>.
     * If <code>toFile</code> already exists, then it will be replaced with a copy of
     * <code>fromFile</code>. The name and path of <code>toFile</code> will be that of
     * <code>toFile</code>.<br/>
     * <br/>
     * <i> Note: <code>fromFile</code> and <code>toFile</code> will be closed by this function.</i>
     *
     * @param fromFile - FileInputStream for the file to copy from.
     * @param toFile   - FileInputStream for the file to copy to.
     */
    public static void copyFile(FileInputStream fromFile, FileOutputStream toFile) throws IOException {
        FileChannel fromChannel = null;
        FileChannel toChannel = null;
        try {
            fromChannel = fromFile.getChannel();
            toChannel = toFile.getChannel();
            fromChannel.transferTo(0, fromChannel.size(), toChannel);
        } finally {
            try {
                if (fromChannel != null) {
                    fromChannel.close();
                }
            } finally {
                if (toChannel != null) {
                    toChannel.close();
                }
            }
        }
    }
}




Java Source Code List

com.google.zxing.integration.android.IntentIntegrator.java
com.google.zxing.integration.android.IntentResult.java
com.selesse.android.winedb.activity.CreateOrEditWineActivity.java
com.selesse.android.winedb.activity.SingleWineFragment.java
com.selesse.android.winedb.activity.SingleWineViewActivity.java
com.selesse.android.winedb.activity.WineCollectionPagerAdapter.java
com.selesse.android.winedb.activity.WineDB.java
com.selesse.android.winedb.activity.WineListFragment.java
com.selesse.android.winedb.async.AsyncImageLoader.java
com.selesse.android.winedb.contentprovider.WineContentProvider.java
com.selesse.android.winedb.database.FileDatabaseBackup.java
com.selesse.android.winedb.database.FileUtils.java
com.selesse.android.winedb.database.WineDatabaseHandler.java
com.selesse.android.winedb.database.Wine.java
com.selesse.android.winedb.model.RequestCode.java
com.selesse.android.winedb.model.SortOrder.java
com.selesse.android.winedb.model.WineColor.java
com.selesse.android.winedb.model.WineContextMenu.java
com.selesse.android.winedb.winescraper.AbstractWineResponse.java
com.selesse.android.winedb.winescraper.WineResponse.java
com.selesse.android.winedb.winescraper.WineScraperThread.java
com.selesse.android.winedb.winescraper.WineScraper.java
com.selesse.android.winedb.winescraper.WineScrapers.java
com.selesse.android.winedb.winescraper.impl.Semantics3Response.java
com.selesse.android.winedb.winescraper.impl.Semantics3WineScraper.java
com.selesse.android.winedb.winescraper.impl.UPCDatabaseOrgResponse.java
com.selesse.android.winedb.winescraper.impl.UPCDatabaseOrgWineScraper.java
com.selesse.android.winedb.winescraper.impl.UPCDatabaseWineScraper.java