文件存储
来源:互联网 发布:恢复数据多少钱 编辑:程序博客网 时间:2024/04/27 13:03
Android 文件保存;
public String mSdcardDir = null;
public String mWorkDir = "/test";
public String myDateName;
mSdcardDir = Environment.getExternalStorageDirectory().toString();
mWorkDir = String.format("%s%s", mSdcardDir, mWorkDir);
if( !createWorkDir (mWorkDir))
{
Log.e(TAG,"can't create file ");
}
int previewNum=0;
myDateName= String.format("%s/%d_.yuv",mWorkDir,previewNum);
saveImage(myDateName,data);
public boolean createWorkDir(String dirName)
{
if (dirName == null || dirName.toLowerCase().compareTo("null") == 0)
return false;
File pFile = new File(dirName);
if (!pFile.exists())
{
try
{
boolean rev = pFile.mkdirs();
if (rev)
return true;
else
return false;
} catch (Exception e)
{
e.printStackTrace();
return false;
}
}
return true;
}
public static boolean saveImage(String fullpath, byte[] jpegData)
{
boolean success = false;
if (null != fullpath)
{
try
{
File file = new File(fullpath);
FileOutputStream fs = new FileOutputStream(fullpath);
fs.write(jpegData);
fs.close();
success = true;
} catch (FileNotFoundException e)
{
} catch (IOException e)
{
} finally
{
}
return success;
} else
return success;
}
Java 文件保存
try
{
FileOutputStream fout=new FileOutputStream("D:\\eer.txt");
try
{
byte []ds={'1','2','3'};
fout.write(ds, 0, 3);
fout.flush();
fout.close();
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
C文件的读写
File *pFile;
??????????
pFile=fopen("/mnt/sdcard/" ,"rb");
fwrite( dataBuffer , size,num, pfile );
Fclose(pFile);
Android 文件保存;
public String mSdcardDir = null;
public String mWorkDir = "/test";
public String myDateName;
mSdcardDir = Environment.getExternalStorageDirectory().toString();
mWorkDir = String.format("%s%s", mSdcardDir, mWorkDir);
if( !createWorkDir (mWorkDir))
{
Log.e(TAG,"can't create file ");
}
int previewNum=0;
myDateName= String.format("%s/%d_.yuv",mWorkDir,previewNum);
saveImage(myDateName,data);
public boolean createWorkDir(String dirName)
{
if (dirName == null || dirName.toLowerCase().compareTo("null") == 0)
return false;
File pFile = new File(dirName);
if (!pFile.exists())
{
try
{
boolean rev = pFile.mkdirs();
if (rev)
return true;
else
return false;
} catch (Exception e)
{
e.printStackTrace();
return false;
}
}
return true;
}
public static boolean saveImage(String fullpath, byte[] jpegData)
{
boolean success = false;
if (null != fullpath)
{
try
{
File file = new File(fullpath);
FileOutputStream fs = new FileOutputStream(fullpath);
fs.write(jpegData);
fs.close();
success = true;
} catch (FileNotFoundException e)
{
} catch (IOException e)
{
} finally
{
}
return success;
} else
return success;
}
Java 文件保存
try
{
FileOutputStream fout=new FileOutputStream("D:\\eer.txt");
try
{
byte []ds={'1','2','3'};
fout.write(ds, 0, 3);
fout.flush();
fout.close();
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
C文件的读写
File *pFile;
??????????
if( pFile= fopen("/mnt/sdcard/" ,"rb") )
{
fwrite( dataBuffer , size,num, pfile );
Fclose(pFile);
}
- Android存储-文件存储
- 数据存储-文件存储
- 数据存储--文件存储
- 文件存储、SharedPreferences存储
- android存储---文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- 文件存储
- Hibernate查询数据表char类型字段只返回一个字符
- Oracle 用SqlPlus 连接远程数据库以及导入导出表
- iPhone开发【十六】实现点击一个UIImageView时打开键盘
- 程序员编程艺术:第七章、求连续子数组的最大和
- 你未必知道的CSS故事:揭开leading的面纱
- 文件存储
- PreferenceScreen
- 程序员编程艺术:第八章、从头至尾漫谈虚函数
- 关于uboot如何找内核,内核如何找根文件系统的个人见解
- ip地址格式可以有前置0吗
- 创建iOS单元测试
- [转]Stage3D 翻译系列之六:一个真正的纯Stage3D应用(一)
- 三元表达式
- UIView相关方法