當前位置: 首頁>>代碼示例>>Java>>正文


Java SmbFile.delete方法代碼示例

本文整理匯總了Java中jcifs.smb.SmbFile.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java SmbFile.delete方法的具體用法?Java SmbFile.delete怎麽用?Java SmbFile.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在jcifs.smb.SmbFile的用法示例。


在下文中一共展示了SmbFile.delete方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: smbDel

import jcifs.smb.SmbFile; //導入方法依賴的package包/類
/**
 * 把本地磁盤中的文件從局域網共享文件中刪除
 * 
 * @param remoteUrl
 *            共享電腦路徑 如:smb//administrator:[email protected]/smb
 */
public static void smbDel(String remoteUrl) {
	try {
		SmbFile remoteFile = new SmbFile(SMBPATH + remoteUrl);
		if (remoteFile.isFile() && remoteFile.exists()) {
			remoteFile.delete();
			logger.info("刪除遠程文件 :" + remoteUrl);
		}
	} catch (Exception e) {
		logger.error(e);
	} 
}
 
開發者ID:ZiryLee,項目名稱:FileUpload2Spring,代碼行數:18,代碼來源:SmbUtil.java

示例2: delete

import jcifs.smb.SmbFile; //導入方法依賴的package包/類
@Override
public boolean delete(String srcPath) throws IOException {
	if (isDirectory(srcPath) && !srcPath.endsWith("/")){
		srcPath+="/";
	}
	SmbFile currentFolder = new SmbFile(getAbsolutePath(srcPath), authentication);

	try {
		currentFolder.delete();
		return true;
	} catch (Exception e){
		e.printStackTrace();
		return false;
	}
}
 
開發者ID:starn,項目名稱:encdroidMC,代碼行數:16,代碼來源:FileProvider3.java

示例3: deleteOnRemote

import jcifs.smb.SmbFile; //導入方法依賴的package包/類
/**
 * @param remoteFile
 * @param remoteFolder
 * @throws IOException
 */
private void deleteOnRemote(String remoteFile, String remoteFolder) throws IOException {
    String dir = "";
    if (remoteFolder != null)
        dir = remoteFolder + File.separator;
    String fname = share + File.separator + dir + remoteFile;
    fname = fname.replace('\\', '/');

    SmbFile file = new SmbFile(fname, auth);
    file.delete();
}
 
開發者ID:mstritt,項目名稱:orbit-image-analysis,代碼行數:16,代碼來源:SmbUtils.java

示例4: beforeClass

import jcifs.smb.SmbFile; //導入方法依賴的package包/類
@BeforeClass
void beforeClass() throws IOException {
    Properties properties = new Properties();
    InputStream propertiesInput = new FileInputStream(PROPERTIES);
    try {
        properties.load(propertiesInput);

        for (String prop : requiredProperties) {
            if (properties.getProperty(prop, "").isEmpty()) {
                throw new IllegalStateException("Missing required property " + prop + " in " + PROPERTIES);
            }
        }
        SERVER = properties.getProperty("SERVER");
        SERVER_IP = properties.getProperty("SERVER_IP");
        SHARE = properties.getProperty("SHARE");
        DIR = properties.getProperty("DIR");

        WRITE_DIR = DIR + "/";
        SRC_DIR = DIR + "/Junk/";
        FILE1 = SRC_DIR + "10883563.doc";
        URL_SERVER = "smb://" + SERVER + "/";
        URL_SHARE = URL_SERVER + SHARE + "/";
        URL_WRITE_DIR = URL_SHARE + WRITE_DIR;

        for (Map.Entry<Object,Object> propEntry : properties.entrySet()) {
            System.setProperty((String)propEntry.getKey(), (String)propEntry.getValue());
        }

        SmbFile dir = new SmbFile(URL_WRITE_DIR);
        if (dir.exists()) {
            dir.delete();
        }
        SmbFile srcDir = new SmbFile(URL_SHARE + SRC_DIR);
        if (!srcDir.exists()) {
            srcDir.mkdirs();
        }
        SmbFile file1 = new SmbFile(URL_SHARE + FILE1);
        if (!file1.exists()) {
            file1.createNewFile();
            OutputStream os = file1.getOutputStream();
            try {
                IOUtils.copy(getClass().getResourceAsStream("10883563.doc"), os);
            } finally {
                IOUtils.closeQuietly(os);
            }
        }

    } finally {
        IOUtils.closeQuietly(propertiesInput);
    }
}
 
開發者ID:IdentityAutomation,項目名稱:jcifs-idautopatch,代碼行數:52,代碼來源:JCIFSTest.java

示例5: delete

import jcifs.smb.SmbFile; //導入方法依賴的package包/類
/**
 * Deletes the file under the provided {@link SMBPath}
 *
 * @param path {@link SMBPath} to file that should be deleted.
 *
 * @throws IllegalArgumentException If provided path is not an {@link SMBPath} instance.
 * @throws IOException If deleting the file fails for some reason.
 */
@Override
public void delete(Path path) throws IOException {
    SmbFile smbFile = SMBPath.fromPath(path).getSmbFile();
    smbFile.delete();
}
 
開發者ID:pontiussoftware,項目名稱:smb-nio,代碼行數:14,代碼來源:SMBFileSystemProvider.java


注:本文中的jcifs.smb.SmbFile.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。