本文整理汇总了Java中info.guardianproject.iocipher.File类的典型用法代码示例。如果您正苦于以下问题:Java File类的具体用法?Java File怎么用?Java File使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
File类属于info.guardianproject.iocipher包,在下文中一共展示了File类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: closeFile
import info.guardianproject.iocipher.File; //导入依赖的package包/类
public String closeFile() throws IOException {
//Log.e(TAG, "closeFile") ;
raf.close();
File file = new File(localFilename);
String newPath = file.getCanonicalPath();
if(true) return newPath;
newPath = newPath.substring(0,newPath.length()-4); // remove the .tmp
//Log.e(TAG, "vfsCloseFile: rename " + newPath) ;
File newPathFile = new File(newPath);
boolean success = file.renameTo(newPathFile);
if (!success) {
throw new IOException("Rename error " + newPath );
}
return newPath;
}
开发者ID:zom,项目名称:Zom-Android,代码行数:17,代码来源:OtrDataHandler.java
示例2: loadOmemoPreKeys
import info.guardianproject.iocipher.File; //导入依赖的package包/类
@Override
public HashMap<Integer, T_PreKey> loadOmemoPreKeys(OmemoManager omemoManager) {
File preKeyDirectory = hierarchy.getPreKeysDirectory(omemoManager);
HashMap<Integer, T_PreKey> preKeys = new HashMap<>();
if (preKeyDirectory == null) {
return preKeys;
}
File[] keys = preKeyDirectory.listFiles();
for (File f : keys != null ? keys : new File[0]) {
try {
byte[] bytes = readBytes(f);
if (bytes == null) {
continue;
}
T_PreKey p = keyUtil().preKeyFromBytes(bytes);
preKeys.put(Integer.parseInt(f.getName()), p);
} catch (IOException e) {
//Do nothing
}
}
return preKeys;
}
开发者ID:zom,项目名称:Zom-Android,代码行数:27,代码来源:IOCipherOmemoStore.java
示例3: loadOmemoSignedPreKeys
import info.guardianproject.iocipher.File; //导入依赖的package包/类
@Override
public HashMap<Integer, T_SigPreKey> loadOmemoSignedPreKeys(OmemoManager omemoManager) {
File signedPreKeysDirectory = hierarchy.getSignedPreKeysDirectory(omemoManager);
HashMap<Integer, T_SigPreKey> signedPreKeys = new HashMap<>();
if (signedPreKeysDirectory == null) {
return signedPreKeys;
}
File[] keys = signedPreKeysDirectory.listFiles();
for (File f : keys != null ? keys : new File[0]) {
try {
byte[] bytes = readBytes(f);
if (bytes == null) {
continue;
}
T_SigPreKey p = keyUtil().signedPreKeyFromBytes(bytes);
signedPreKeys.put(Integer.parseInt(f.getName()), p);
} catch (IOException e) {
//Do nothing
}
}
return signedPreKeys;
}
开发者ID:zom,项目名称:Zom-Android,代码行数:27,代码来源:IOCipherOmemoStore.java
示例4: removeAllRawSessionsOf
import info.guardianproject.iocipher.File; //导入依赖的package包/类
@Override
public void removeAllRawSessionsOf(OmemoManager omemoManager, BareJid contact) {
File contactsDirectory = hierarchy.getContactsDir(omemoManager, contact);
String[] devices = contactsDirectory.list();
for (String deviceId : devices != null ? devices : new String[0]) {
int id;
try {
id = Integer.parseInt(deviceId);
} catch (NumberFormatException e) {
continue;
}
OmemoDevice device = new OmemoDevice(contact, id);
File session = hierarchy.getContactsSessionPath(omemoManager, device);
session.delete();
}
}
开发者ID:zom,项目名称:Zom-Android,代码行数:18,代码来源:IOCipherOmemoStore.java
示例5: writeInt
import info.guardianproject.iocipher.File; //导入依赖的package包/类
private void writeInt(File target, int i) throws IOException {
if (target == null) {
throw new IOException("Could not write integer to null-path.");
}
FileHierarchy.createFile(target);
IOException io = null;
DataOutputStream out = null;
try {
out = new DataOutputStream(new FileOutputStream(target));
out.writeInt(i);
} catch (IOException e) {
io = e;
} finally {
if (out != null) {
out.close();
}
}
if (io != null) {
throw io;
}
}
开发者ID:zom,项目名称:Zom-Android,代码行数:25,代码来源:IOCipherOmemoStore.java
示例6: writeLong
import info.guardianproject.iocipher.File; //导入依赖的package包/类
private void writeLong(File target, long i) throws IOException {
if (target == null) {
throw new IOException("Could not write long to null-path.");
}
FileHierarchy.createFile(target);
IOException io = null;
DataOutputStream out = null;
try {
out = new DataOutputStream(new FileOutputStream(target));
out.writeLong(i);
} catch (IOException e) {
io = e;
} finally {
if (out != null) {
out.close();
}
}
if (io != null) {
throw io;
}
}
开发者ID:zom,项目名称:Zom-Android,代码行数:27,代码来源:IOCipherOmemoStore.java
示例7: deleteDirectory
import info.guardianproject.iocipher.File; //导入依赖的package包/类
public static void deleteDirectory(File root) {
File[] currList;
Stack<File> stack = new Stack<>();
stack.push(root);
while (!stack.isEmpty()) {
if (stack.lastElement().isDirectory()) {
currList = stack.lastElement().listFiles();
if (currList != null && currList.length > 0) {
for (File curr : currList) {
stack.push(curr);
}
} else {
stack.pop().delete();
}
} else {
stack.pop().delete();
}
}
}
开发者ID:zom,项目名称:Zom-Android,代码行数:20,代码来源:IOCipherOmemoStore.java
示例8: loadCredentials
import info.guardianproject.iocipher.File; //导入依赖的package包/类
private boolean loadCredentials ()
{
try
{
Properties props = new Properties();
info.guardianproject.iocipher.File fileProps = new info.guardianproject.iocipher.File("/dropbox.properties");
if (fileProps.exists())
{
info.guardianproject.iocipher.FileInputStream fis = new info.guardianproject.iocipher.FileInputStream(fileProps);
props.loadFromXML(fis);
mStoredAccessToken = props.getProperty("dbtoken");
return true;
}
}
catch (IOException ioe)
{
Log.e("DbAuthLog", "Error I/O", ioe);
}
return false;
}
开发者ID:guardianproject,项目名称:CameraV,代码行数:27,代码来源:DropboxSyncManager.java
示例9: saveCredentials
import info.guardianproject.iocipher.File; //导入依赖的package包/类
private void saveCredentials () throws IOException
{
if (mSession != null && mSession.isLinked()
&& mSession.getOAuth2AccessToken() != null)
{
mStoredAccessToken = mSession.getOAuth2AccessToken();
Properties props = new Properties();
props.setProperty("dbtoken", mStoredAccessToken);
info.guardianproject.iocipher.File fileProps = new info.guardianproject.iocipher.File("/dropbox.properties");
info.guardianproject.iocipher.FileOutputStream fos = new info.guardianproject.iocipher.FileOutputStream(fileProps);
props.storeToXML(fos,"");
fos.close();
}
else
{
Log.d("Dropbox","no valid dropbox session / not linked");
}
}
开发者ID:guardianproject,项目名称:CameraV,代码行数:25,代码来源:DropboxSyncManager.java
示例10: startRecording
import info.guardianproject.iocipher.File; //导入依赖的package包/类
private void startRecording ()
{
String fileName = "audio" + new java.util.Date().getTime();
info.guardianproject.iocipher.File fileOut = new info.guardianproject.iocipher.File(mFileBasePath,fileName);
try {
mIsRecording = true;
if (useAAC)
initAudio(fileOut.getAbsolutePath()+".aac");
else
initAudio(fileOut.getAbsolutePath()+".pcm");
startAudioRecording();
} catch (Exception e) {
Log.d("Video","error starting video",e);
Toast.makeText(this, "Error init'ing video: " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
finish();
}
}
开发者ID:guardianproject,项目名称:CameraV,代码行数:24,代码来源:AudioRecorderActivity.java
示例11: shareExternalFile
import info.guardianproject.iocipher.File; //导入依赖的package包/类
private void shareExternalFile (java.io.File fileExtern)
{
Uri uri = Uri.fromFile(fileExtern);
Intent intent = new Intent(Intent.ACTION_SEND);
String fileExtension = MimeTypeMap.getFileExtensionFromUrl(uri.toString());
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
if (fileExtension.equals("mp4") || fileExtension.equals("mkv") || fileExtension.equals("mov"))
mimeType = "video/*";
if (mimeType == null)
mimeType = "application/octet-stream";
intent.setDataAndType(uri, mimeType);
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.putExtra(Intent.EXTRA_SUBJECT, fileExtern.getName());
intent.putExtra(Intent.EXTRA_TITLE, fileExtern.getName());
try {
startActivity(Intent.createChooser(intent, "Share this!"));
} catch (ActivityNotFoundException e) {
Log.e(TAG, "No relevant Activity found", e);
}
}
开发者ID:guardianproject,项目名称:CameraV,代码行数:25,代码来源:GalleryActivity.java
示例12: doInBackground
import info.guardianproject.iocipher.File; //导入依赖的package包/类
@Override
protected File doInBackground(byte[]... data) {
try {
long mTime = System.currentTimeMillis();
File fileSecurePicture = new File(mFileBasePath, "camerav_image_" + mTime + ".jpg");
mResultList.add(fileSecurePicture.getAbsolutePath());
FileOutputStream out = new FileOutputStream(fileSecurePicture);
out.write(data[0]);
out.flush();
out.close();
return fileSecurePicture;
} catch (IOException ioe) {
Log.e(StillCameraActivity.class.getName(), "error saving picture", ioe);
}
return null;
}
开发者ID:guardianproject,项目名称:CameraV,代码行数:23,代码来源:StillCameraActivity.java
示例13: fillPathsArrayInReverse
import info.guardianproject.iocipher.File; //导入依赖的package包/类
private void fillPathsArrayInReverse() {
imagePaths = new ArrayList<String>();
SecureFile[] childrenGalleryImageFiles = getGalleryDir().listFiles();
for (int index = childrenGalleryImageFiles.length - 1; index >= 0; index--) {
File imageFile = childrenGalleryImageFiles[index];
imagePaths.add(imageFile.getPath());
}
if (imagePaths.isEmpty())
emptyGalleryLabel.setVisibility(View.VISIBLE);
else
emptyGalleryLabel.setVisibility(View.GONE);
}
开发者ID:benetech,项目名称:Secure-App-Generator,代码行数:14,代码来源:SecureGallery.java
示例14: showItem
import info.guardianproject.iocipher.File; //导入依赖的package包/类
private void showItem (File file)
{
try {
String fileExtension = MimeTypeMap.getFileExtensionFromUrl(file.getAbsolutePath());
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
if (mimeType.startsWith("image")) {
Intent intent = new Intent(SecureGallery.this,ImageViewerActivity.class);
intent.setType(mimeType);
intent.putExtra("vfs", file.getAbsolutePath());
startActivity(intent);
}
} catch (ActivityNotFoundException e) {
Log.e(TAG, getString(R.string.error_message_no_relevant_activity_found), e);
}
}
开发者ID:benetech,项目名称:Secure-App-Generator,代码行数:16,代码来源:SecureGallery.java
示例15: getPreview
import info.guardianproject.iocipher.File; //导入依赖的package包/类
protected Bitmap getPreview(File fileImage) throws FileNotFoundException {
Bitmap bitmap;
synchronized (mBitCache) {
bitmap = mBitCache.get(fileImage.getAbsolutePath());
if (bitmap == null && mBitLoaders.get(fileImage.getAbsolutePath())==null) {
BitmapWorkerThread bwt = new BitmapWorkerThread(fileImage);
mBitLoaders.put(fileImage.getAbsolutePath(),bwt);
bwt.start();
}
}
return bitmap;
}
开发者ID:benetech,项目名称:Secure-App-Generator,代码行数:15,代码来源:SecureGallery.java
示例16: openSecureStorageFile
import info.guardianproject.iocipher.File; //导入依赖的package包/类
public File openSecureStorageFile(String sessionId, String url) throws FileNotFoundException {
// debug( "openFile: url " + url) ;
String filename = getFilenameFromUrl(url);
String localFilename = SecureMediaStore.getDownloadFilename(sessionId, filename);
// debug( "openFile: localFilename " + localFilename) ;
info.guardianproject.iocipher.File fileNew = new info.guardianproject.iocipher.File(localFilename);
fileNew.getParentFile().mkdirs();
return fileNew;
}
开发者ID:zom,项目名称:Zom-Android,代码行数:12,代码来源:Downloader.java
示例17: checkSum
import info.guardianproject.iocipher.File; //导入依赖的package包/类
@Override
public boolean checkSum() {
try {
File file = new File(localFilename);
return sum.equals( checkSum(file.getAbsolutePath()) );
} catch (IOException e) {
debug("checksum IOException");
return false;
}
}
开发者ID:zom,项目名称:Zom-Android,代码行数:11,代码来源:OtrDataHandler.java
示例18: openFile
import info.guardianproject.iocipher.File; //导入依赖的package包/类
private RandomAccessFile openFile(String url) throws FileNotFoundException {
debug( "openFile: url " + url) ;
String sessionId = ""+ mChatId;
String filename = getFilenameFromUrl(url);
localFilename = SecureMediaStore.getDownloadFilename(sessionId, filename);
debug( "openFile: localFilename " + localFilename) ;
info.guardianproject.iocipher.File fileNew = new info.guardianproject.iocipher.File(localFilename);
fileNew.getParentFile().mkdirs();
info.guardianproject.iocipher.RandomAccessFile ras = new info.guardianproject.iocipher.RandomAccessFile(localFilename, "rw");
return ras;
}
开发者ID:zom,项目名称:Zom-Android,代码行数:12,代码来源:OtrDataHandler.java
示例19: IOCipherOmemoStore
import info.guardianproject.iocipher.File; //导入依赖的package包/类
public IOCipherOmemoStore(java.io.File basePath) {
super();
if (basePath == null) {
throw new IllegalStateException("No FileBasedOmemoStoreDefaultPath set in OmemoConfiguration.");
}
this.hierarchy = new FileHierarchy(new File(basePath.getAbsolutePath()));
}
开发者ID:zom,项目名称:Zom-Android,代码行数:8,代码来源:IOCipherOmemoStore.java
示例20: setDefaultDeviceId
import info.guardianproject.iocipher.File; //导入依赖的package包/类
@Override
public void setDefaultDeviceId(BareJid user, int defaultDeviceId) {
File defaultDeviceIdPath = hierarchy.getDefaultDeviceIdPath(user);
if (defaultDeviceIdPath == null) {
LOGGER.log(Level.SEVERE, "defaultDeviceIdPath is null!");
}
try {
writeInt(defaultDeviceIdPath, defaultDeviceId);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Could not write defaultDeviceId: " + e, e);
}
}
开发者ID:zom,项目名称:Zom-Android,代码行数:15,代码来源:IOCipherOmemoStore.java
注:本文中的info.guardianproject.iocipher.File类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论