本文整理汇总了Java中org.kymjs.kjframe.utils.FileUtils类的典型用法代码示例。如果您正苦于以下问题:Java FileUtils类的具体用法?Java FileUtils怎么用?Java FileUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileUtils类属于org.kymjs.kjframe.utils包,在下文中一共展示了FileUtils类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
开发者ID:woniukeji,项目名称:jianguo,代码行数:19,代码来源:ChatActivity.java
示例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);
}
}
}
开发者ID:hhhizzz,项目名称:android_chat_UI,代码行数:19,代码来源:ChatActivity.java
示例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;
}
开发者ID:sczyh30,项目名称:yuedong-app,代码行数:20,代码来源:AppException.java
示例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;
}
开发者ID:haiyangxue,项目名称:blogplu,代码行数:20,代码来源:AppException.java
示例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);
}
开发者ID:KJFrame,项目名称:KJBlog,代码行数:25,代码来源:Splash.java
示例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();
}
开发者ID:KJFrame,项目名称:KJBlog,代码行数:20,代码来源:CrashHandler.java
示例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);
}
});
}
开发者ID:kymjs,项目名称:KJFrameForAndroid,代码行数:28,代码来源:HttpActivity.java
示例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;
}
开发者ID:kymjs,项目名称:oschina-gam,代码行数:16,代码来源:CacheUtil.java
示例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"));
}
});
}
开发者ID:KJFrame,项目名称:KJBlog,代码行数:28,代码来源:CommonService.java
示例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"));
}
});
}
开发者ID:KJFrame,项目名称:KJBlog,代码行数:28,代码来源:AboutFragment.java
示例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;
}
}
开发者ID:KJFrame,项目名称:KJBlog,代码行数:40,代码来源:MineFragment.java
示例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);
}
}
}
开发者ID:KJFrame,项目名称:KJBlog,代码行数:13,代码来源:TweetRecordFragment.java
示例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");
}
}
开发者ID:kymjs,项目名称:KJFrameForAndroid,代码行数:14,代码来源:HttpParams.java
示例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);
}
开发者ID:kymjs,项目名称:KJFrameForAndroid,代码行数:10,代码来源:HttpConfig.java
示例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();
}
开发者ID:kymjs,项目名称:KJFrameForAndroid,代码行数:9,代码来源:HttpActivity.java
示例16: save
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
private void save() {
KJBitmap kjb = new KJBitmap();
kjb.saveImage(this, "http://www.kymjs.com/image/logo.png",
FileUtils.getSDCardPath() + "/OSL.png");
}
开发者ID:kymjs,项目名称:KJFrameForAndroid,代码行数:6,代码来源:BitmapActivity.java
示例17: bitmapFromStream
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
/**
* 获取一个指定大小的bitmap<br>
* 实际调用的方法是bitmapFromByteArray(data, 0, data.length, w, h);
*
* @param is 从输入流中读取Bitmap
* @param reqWidth 目标宽度
* @param reqHeight 目标高度
*/
public static Bitmap bitmapFromStream(InputStream is, int reqWidth,
int reqHeight) {
if (reqHeight == 0 || reqWidth == 0) {
try {
return BitmapFactory.decodeStream(is);
} catch (OutOfMemoryError e) {
}
}
byte[] data = FileUtils.input2byte(is);
return bitmapFromByteArray(data, 0, data.length, reqWidth, reqHeight);
}
开发者ID:kymjs,项目名称:KJFrameForAndroid,代码行数:20,代码来源:BitmapCreate.java
示例18: loadFromFile
import org.kymjs.kjframe.utils.FileUtils; //导入依赖的package包/类
/**
* 从本地载入一张图片
*
* @param path
* 图片的地址
* @throws FileNotFoundException
*/
private byte[] loadFromFile(String path, int maxWidth, int maxHeight,
BitmapCallBack callback) {
byte[] data = null;
FileInputStream fis = null;
try {
fis = new FileInputStream(path);
if (fis != null) {
data = FileUtils.input2byte(fis);
}
handleBitmap(data, maxWidth, maxHeight, callback);
} catch (Exception e) {
doFailure(callback, e);
} finally {
FileUtils.closeIO(fis);
}
return data;
}
开发者ID:kymjs,项目名称:KJFrameForAndroid,代码行数:25,代码来源:DiskImageRequest.java
注:本文中的org.kymjs.kjframe.utils.FileUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论