本文整理汇总了Java中org.zirco.utils.IOUtils类的典型用法代码示例。如果您正苦于以下问题:Java IOUtils类的具体用法?Java IOUtils怎么用?Java IOUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IOUtils类属于org.zirco.utils包,在下文中一共展示了IOUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: importHistoryBookmarks
import org.zirco.utils.IOUtils; //导入依赖的package包/类
/**
* Ask the user the file to import to bookmarks and history, and launch the import.
*/
private void importHistoryBookmarks() {
List<String> exportedFiles = IOUtils.getExportedBookmarksFileList();
final String[] choices = exportedFiles.toArray(new String[exportedFiles.size()]);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setInverseBackgroundForced(true);
builder.setIcon(android.R.drawable.ic_dialog_info);
builder.setTitle(getResources().getString(R.string.Commons_ImportHistoryBookmarksSource));
builder.setSingleChoiceItems(choices,
0,
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
doImportHistoryBookmarks(choices[which]);
dialog.dismiss();
}
});
builder.setCancelable(true);
builder.setNegativeButton(R.string.Commons_Cancel, null);
AlertDialog alert = builder.create();
alert.show();
}
示例2: getFile
import org.zirco.utils.IOUtils; //导入依赖的package包/类
/**
* Get a file object representation of the file name, in th right folder of the SD card.
* @return A file object.
*/
private File getFile() {
File downloadFolder = IOUtils.getDownloadFolder();
if (downloadFolder != null) {
return new File(downloadFolder, getFileNameFromUrl());
} else {
mParent.setErrorMessage("Unable to get download folder from SD Card.");
return null;
}
}
示例3: getFilePath
import org.zirco.utils.IOUtils; //导入依赖的package包/类
public String getFilePath() {
return IOUtils.getDownloadFolder().getAbsolutePath() + File.separator + mFileName;
}
示例4: run
import org.zirco.utils.IOUtils; //导入依赖的package包/类
@Override
public void run() {
try {
mFile = new File(IOUtils.getBookmarksExportFolder(), mFileName);
FileWriter writer = new FileWriter(mFile);
writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
writer.write("<itemlist>\n");
if (mCursor.moveToFirst()) {
int titleIndex = mCursor.getColumnIndex(Browser.BookmarkColumns.TITLE);
int urlIndex = mCursor.getColumnIndex(Browser.BookmarkColumns.URL);
int visitsIndex = mCursor.getColumnIndex(Browser.BookmarkColumns.VISITS);
int dateIndex = mCursor.getColumnIndex(Browser.BookmarkColumns.DATE);
int createdIndex = mCursor.getColumnIndex(Browser.BookmarkColumns.CREATED);
int bookmarkIndex = mCursor.getColumnIndex(Browser.BookmarkColumns.BOOKMARK);
while (!mCursor.isAfterLast()) {
writer.write("<item>\n");
String title = mCursor.getString(titleIndex);
writer.write(String.format("<title>%s</title>\n", title != null ? URLEncoder.encode(title) : ""));
String url = mCursor.getString(urlIndex);
writer.write(String.format("<url>%s</url>\n", url != null ? URLEncoder.encode(url) : ""));
writer.write(String.format("<created>%s</created>\n", mCursor.getLong(createdIndex)));
writer.write(String.format("<visits>%s</visits>\n", mCursor.getInt(visitsIndex)));
writer.write(String.format("<date>%s</date>\n", mCursor.getLong(dateIndex)));
writer.write(String.format("<bookmark>%s</bookmark>\n", mCursor.getInt(bookmarkIndex)));
writer.write("</item>\n");
mCursor.moveToNext();
}
}
writer.write("</itemlist>\n");
writer.flush();
writer.close();
} catch (IOException e1) {
Log.w("Bookmark export failed", e1.toString());
mErrorMessage = e1.toString();
}
mHandler.sendEmptyMessage(0);
}