本文整理匯總了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;
}
示例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;
}
示例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);
}
示例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();
}
}
示例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;
}
}