本文整理汇总了Java中org.kymjs.kjframe.utils.FileUtils类的典型用法代码示例。如果您正苦于以下问题:Java FileUtils类的具体用法?Java FileUtils怎么用?Java FileUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileUtils类属于org.kymjs.kjframe.utils包,在下文中一共展示了FileUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != Activity.RESULT_OK) {
return;
}
if (requestCode == REQUEST_CODE_GETIMAGE_BYSDCARD) {
Uri dataUri = data.getData();
if (dataUri != null) {
File file = FileUtils.uri2File(aty, dataUri);
Message message = new Message(Message.MSG_TYPE_PHOTO, Message.MSG_STATE_SUCCESS,
"Tom", "avatar", "Jerry",
"avatar", file.getAbsolutePath(), true, true, new Date());
// datas.add(message);
adapter.refresh(datas);
}
}
}
示例2: onActivityResult
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != Activity.RESULT_OK) {
return;
}
if (requestCode == REQUEST_CODE_GETIMAGE_BYSDCARD) {
Uri dataUri = data.getData();
if (dataUri != null) {
File file = FileUtils.uri2File(aty, dataUri);
Message message = new Message(Message.MSG_TYPE_PHOTO, Message.MSG_STATE_SUCCESS,
"Tom", "avatar", "Jerry",
"avatar", file.getAbsolutePath(), true, true, new Date());
datas.add(message);
adapter.refresh(datas);
}
}
}
示例3: saveToSDCard
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
private boolean saveToSDCard(Throwable ex) throws Exception {
boolean append = false;
File file = FileUtils.getSaveFile("Yuedong", "yuedong_log.log");
if (System.currentTimeMillis() - file.lastModified() > 5000) {
append = true;
}
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(
file, append)));
// 导出发生异常的时间
pw.println(SystemTool.getDataTime("yyyy-MM-dd-HH-mm-ss"));
// 导出手机信息
dumpPhoneInfo(pw);
pw.println();
// 导出异常的调用栈信息
ex.printStackTrace(pw);
pw.println();
pw.close();
return append;
}
示例4: saveToSDCard
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
private boolean saveToSDCard(Throwable ex) throws Exception {
boolean append = false;
File file = FileUtils.getSaveFile("OSChina", "OSCLog.log");
if (System.currentTimeMillis() - file.lastModified() > 5000) {
append = true;
}
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(
file, append)));
// 导出发生异常的时间
pw.println(SystemTool.getDataTime("yyyy-MM-dd-HH-mm-ss"));
// 导出手机信息
dumpPhoneInfo(pw);
pw.println();
// 导出异常的调用栈信息
ex.printStackTrace(pw);
pw.println();
pw.close();
return append;
}
示例5: setUserInterface
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
/**
* 动态设置用户界面
*/
private void setUserInterface() {
String sdCardPath = FileUtils.getSavePath(AppConfig.saveFolder);
String headImgPath = sdCardPath
+ PreferenceHelper.readString(aty, TAG,
AppConfig.SPLASH_HEAD_IMG_KEY, "");
String rootBgPath = sdCardPath
+ PreferenceHelper.readString(aty, TAG,
AppConfig.SPLASH_BACKGROUND_KEY, "");
String boxBgPath = sdCardPath
+ PreferenceHelper.readString(aty, TAG,
AppConfig.SPLASH_BOX_KEY, "");
String contentStr = PreferenceHelper.readString(aty, TAG,
AppConfig.SPLASH_CONTENT_KEY,
getString(R.string.splash_content));
KJBitmap kjb = new KJBitmap();
kjb.display(mRlRoot, rootBgPath);
kjb.display(mImgHead, headImgPath);
kjb.display(mRlBox, boxBgPath);
mTvContent.setText(contentStr);
}
示例6: saveToSDCard
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
private void saveToSDCard(Throwable ex) throws Exception {
File file = FileUtils.getSaveFile(AppConfig.saveFolder,
FILE_NAME_SUFFIX);
boolean append = false;
if (System.currentTimeMillis() - file.lastModified() > 5000) {
append = true;
}
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(
file, append)));
// 导出发生异常的时间
pw.println(SystemTool.getDataTime("yyyy-MM-dd-HH-mm-ss"));
// 导出手机信息
dumpPhoneInfo(pw);
pw.println();
// 导出异常的调用栈信息
ex.printStackTrace(pw);
pw.println();
pw.close();
}
示例7: download
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
/**
* 下载。有一个陷阱需要你注意:下载方法中的KJHttp对象必须和暂停方法中的KJHttp对象为同一个对象
*/
private void download() {
kjh.download(
FileUtils.getSDCardPath() + "/1.apk",
"http://music.baidu.com/cms/mobile/static/apk/Baidumusic_yinyuehexzfc.apk",
new HttpCallBack() {
@Override
public void onLoading(long count, long current) {
super.onLoading(count, current);
KJLoger.debug(count + "====" + current);
}
@Override
public void onSuccess(byte[] t) {
super.onSuccess(t);
toast("完成");
}
@Override
public void onFailure(int errorNo, String strMsg) {
super.onFailure(errorNo, strMsg);
KJLoger.debug(errorNo + "====" + strMsg);
}
});
}
示例8: read
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
public static final Object read(File saveFile) {
FileInputStream fis = null;
ObjectInputStream ois = null;
Object object = null;
try {
fis = new FileInputStream(saveFile);
ois = new ObjectInputStream(fis);
object = ois.readObject();
} catch (Exception e) {
object = null;
} finally {
FileUtils.closeIO(ois, fis);
}
return object;
}
示例9: download
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
private void download(String url) {
final File folder = FileUtils.getSaveFolder(AppConfig.saveFolder);
File tempFile = new File(folder + "/kjblog.apk.tmp");
if (tempFile.exists()) {
tempFile.delete();
}
ViewInject.toast("正在为你下载新版本");
kjh.download(folder + "/kjblog.apk", url, new HttpCallBack() {
/**
* 下载过程
*/
@Override
public void onLoading(long count, long current) {
super.onLoading(count, current);
}
/**
* 下载完成,开始安装
*/
@Override
public void onSuccess(byte[] t) {
super.onSuccess(t);
SystemTool.installApk(CommonService.this, new File(folder
+ "/kjblog.apk"));
}
});
}
示例10: download
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
private void download(String url) {
final File folder = FileUtils.getSaveFolder(AppConfig.saveFolder);
File tempFile = new File(folder + "/kjblog.apk.tmp");
if (tempFile.exists()) {
tempFile.delete();
}
ViewInject.toast("正在为你下载新版本");
kjh.download(folder + "/kjblog.apk", url, new HttpCallBack() {
/**
* 下载过程
*/
@Override
public void onLoading(long count, long current) {
super.onLoading(count, current);
}
/**
* 下载完成,开始安装
*/
@Override
public void onSuccess(byte[] t) {
super.onSuccess(t);
SystemTool.installApk(outsideAty, new File(folder
+ "/kjblog.apk"));
}
});
}
示例11: widgetClick
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
@Override
protected void widgetClick(View v) {
super.widgetClick(v);
switch (v.getId()) {
case R.id.mine_tv_collect:
SimpleBackActivity.postShowWith(outsideAty, SimpleBackPage.COLLECT);
break;
case R.id.mine_tv_other:
UIHelper.toBrowser(outsideAty, "http://www.aplesson.com/MtAndroid/");
break;
case R.id.mine_tv_join:
doJoin("http://jq.qq.com/?_wv=1027&k=XblWhv");
break;
case R.id.mine_rl_push:
isChanged = true;
mCbox.setChecked(!mCbox.isChecked());
break;
case R.id.mine_rl_about:
SimpleBackActivity.postShowWith(outsideAty, SimpleBackPage.ABOUT);
break;
case R.id.mine_rl_clean:
KJAsyncTask.execute(new Runnable() {
@Override
public void run() {
File folder = FileUtils.getSaveFolder(AppConfig.saveFolder);
deleteFile(folder);
}
});
ViewInject.toast("缓存正在后台清除");
break;
case R.id.mine_rl_feedback:
doJoin("http://jq.qq.com/?_wv=1027&k=XblWhv");
break;
case R.id.mine_rl_exit:
break;
default:
break;
}
}
示例12: onActivityResult
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
Uri uri = data.getData();
if (uri != null) {
filePath = FileUtils.uri2File(outsideAty, uri)
.getAbsolutePath();
kjb.display(mImgAdd, filePath, 240, 240);
}
}
}
示例13: put
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
/**
* 添加文件参数,可以实现文件上传功能
*/
public void put(final String key, final File file) {
try {
hasFile = true;
writeToOutputStream(key,
FileUtils.input2byte(new FileInputStream(file)),
TYPE_OCTET_STREAM, BINARY_ENCODING, file.getName());
} catch (FileNotFoundException e) {
Log.e("kjframe", "HttpParams.put()-> file not found");
}
}
示例14: HttpConfig
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
public HttpConfig() {
if (mCache == null) {
File folder = FileUtils.getSaveFolder(CACHEPATH);
mCache = new DiskCache(folder, DISK_CACHE_SIZE);
}
mNetwork = new Network(httpStackFactory());
mDelivery = new DeliveryExecutor(new Handler(Looper.getMainLooper()));
mController = new DownloadTaskQueue(HttpConfig.MAX_DOWNLOAD_TASK_SIZE);
}
示例15: pause
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
/**
* 暂停下载
*/
private void pause() {
kjh.getDownloadController(FileUtils.getSDCardPath() + "/1.apk",
"http://music.baidu.com/cms/mobile/static/apk/Baidumusic_yinyuehexzfc.apk")
.pause();
}