?? copyaction.java
字號:
/** * File and FTP Explorer * Copyright 2003 * BOESCH Vincent * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */package javaexplorer.io.copy;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.nio.ByteBuffer;import java.nio.channels.ReadableByteChannel;import java.nio.channels.WritableByteChannel;import javaexplorer.Launcher;import javaexplorer.ressource.TextRessource;import javaexplorer.util.ExplorerUtil;import javaexplorer.util.comparator.XFileComparator;import javaexplorer.util.options.*;import javaexplorer.model.XFile;/** * Description of the Class * *@author VEEB7280 *@created 13 juin 2002 */public class CopyAction implements CopyModel{ private int cuts = 1; private long[] length = null; private long[] current = null; private long[] initial = null; private long[] startTime = null; private long[] endTime = null; private boolean[] isPartialOk = null; private boolean[] isThreadRunning = null; private XFile[] tab_temp = null; private Thread[] tab_thd = null; private XFile source = null; private XFile dest = null; private boolean _booCopyInitiated = false; private boolean _booCopyFinished = false; private boolean _booDownloadFinished = false; private boolean _booProcessFinished = false; private boolean _booNeedStop = false; private long copyStart = System.currentTimeMillis(); private long copyEnd = 0; private boolean useResume = true; private Launcher _launcher = null; private int currentBuild = 0; private long alreadyDoneLength = 0; private boolean idle = true; private boolean forMove = false; private boolean synchronousCopy = false; /** * Copie par d閒aut utilisant le nombre de copies partielles maximales * @param src * @param dst * @param launcher * @param isTempFile */ public CopyAction(XFile src, XFile dst, Launcher launcher, boolean isSynchronous, boolean isForMove) { this( Options.getOptions().getCutsForCopy(), src, dst, launcher, isSynchronous, isForMove); } /** * Copie param閠r閑 permettant de sp閏ifier le nombre de copies partielles d閟ir閑 * @param numCuts * @param src * @param dst * @param launcher * @param isTempFile */ public CopyAction(int numCuts, XFile src, XFile dst, Launcher launcher, boolean isSynchronous, boolean isForMove) { cuts = numCuts; source = src; dest = dst; _launcher = launcher; synchronousCopy = isSynchronous; forMove = isForMove; initStructures(); } public XFile getSource(){ return source; } public XFile getDestination(){ return dest; } public boolean matchesCopy(XFile src, XFile dst, boolean forTemp ){ return XFileComparator.getComparator().equals(dest, dst) && XFileComparator.getComparator().equals(source, src); } public boolean isCopyFinished(){ return _booCopyFinished; } public boolean isDownloadFinished(){ return _booDownloadFinished; } public String getSrcInfo(){ return source.getPath(); } public String getDestInfo(){ return dest.getPath(); } public String getCopyLength(){ return ExplorerUtil.getLengthAsString(source.length()); } /** * Initialisation des structures * @param numCuts */ public void initStructures(){ if( dest == null ){ alreadyDoneLength = 0; } else{ alreadyDoneLength = dest.length(); } //Le nombre de cuts est d閠ermin
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -