当前位置: 首页>>代码示例>>Java>>正文


Java UniFile.delete方法代码示例

本文整理汇总了Java中com.hippo.unifile.UniFile.delete方法的典型用法代码示例。如果您正苦于以下问题:Java UniFile.delete方法的具体用法?Java UniFile.delete怎么用?Java UniFile.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hippo.unifile.UniFile的用法示例。


在下文中一共展示了UniFile.delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeFromDownloadDir

import com.hippo.unifile.UniFile; //导入方法依赖的package包/类
private boolean removeFromDownloadDir(int index) {
    UniFile dir = getDownloadDir();
    if (dir == null) {
        return false;
    }

    boolean result = false;
    for (int i = 0, n = GalleryProvider2.SUPPORT_IMAGE_EXTENSIONS.length; i < n; i++) {
        String filename = generateImageFilename(index, GalleryProvider2.SUPPORT_IMAGE_EXTENSIONS[i]);
        UniFile file = dir.subFile(filename);
        if (file != null) {
            result |= file.delete();
        }
    }
    return result;
}
 
开发者ID:seven332,项目名称:EhViewer,代码行数:17,代码来源:SpiderDen.java

示例2: clearFile

import com.hippo.unifile.UniFile; //导入方法依赖的package包/类
private boolean clearFile(UniFile file) {
    String name = file.getName();
    int index = name.indexOf('-');
    if (index >= 0) {
        name = name.substring(0, index);
    }
    long gid = NumberUtils.parseLongSafely(name, -1L);
    if (-1L == gid) {
        return false;
    }
    if (mManager.containDownloadInfo(gid)) {
        return false;
    }
    file.delete();
    return true;
}
 
开发者ID:seven332,项目名称:EhViewer,代码行数:17,代码来源:CleanRedundancyPreference.java

示例3: reloadCurrentImage

import com.hippo.unifile.UniFile; //导入方法依赖的package包/类
@Override
public void reloadCurrentImage() {
    GalleryHolder holder = getPagerHolder(0);
    if (holder == null) {
        return;
    }

    // Unload
    holder.galleryPage.unload();

    // Remove in cache
    NMBApplication.getConaco(GalleryActivity2.this).getBeerBelly().remove(mImage);

    // Remove all in save location
    UniFile dir = Settings.getImageSaveLocation();
    if (dir != null) {
        String name = mSite.getReadableName(GalleryActivity2.this) + "-" + mId;
        for (String extension : IMAGE_EXTENSIONS) {
            UniFile file = dir.findFile(name + '.' + extension);
            if (file != null) {
                file.delete();
            }
        }
    }

    // Load
    bindPagerHolder(holder, 0);
}
 
开发者ID:seven332,项目名称:Nimingban,代码行数:29,代码来源:GalleryActivity2.java

示例4: removeNoMediaFile

import com.hippo.unifile.UniFile; //导入方法依赖的package包/类
public static void removeNoMediaFile(UniFile file) {
    if (null == file) {
        return;
    }

    UniFile noMedia = file.subFile(".nomedia");
    if (null != noMedia && noMedia.isFile()) {
        noMedia.delete();
    }
}
 
开发者ID:seven332,项目名称:EhViewer,代码行数:11,代码来源:CommonOperations.java

示例5: save

import com.hippo.unifile.UniFile; //导入方法依赖的package包/类
@Override
public boolean save(InputStream is, long length, String mediaType, ProgressNotify notify) {
    // Get extension and filename
    String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mediaType);
    if (!TextUtils.isEmpty(extension)) {
        mFilename = mName + '.' + extension;
    } else {
        mFilename = mName;
    }

    UniFile file = mDir.createFile(mFilename);
    if (file == null) {
        return false;
    }

    OutputStream os = null;
    try {

        os = file.openOutputStream();

        final byte buffer[] = new byte[1024 * 4];
        long receivedSize = 0;
        int bytesRead;

        while((bytesRead = is.read(buffer)) !=-1) {
            os.write(buffer, 0, bytesRead);
            receivedSize += bytesRead;
            if (length > 0) {
                notify.notifyProgress((long) bytesRead, receivedSize, length);
            }
        }
        os.flush();
        IOUtils.closeQuietly(os);

        // Notify media scanner
        mContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, file.getUri()));

        return true;
    } catch (IOException e) {
        IOUtils.closeQuietly(os);
        file.delete();
        return false;
    }
}
 
开发者ID:seven332,项目名称:Nimingban,代码行数:45,代码来源:GalleryActivity2.java


注:本文中的com.hippo.unifile.UniFile.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。