当前位置: 首页>>代码示例>>Java>>正文


Java VEnvironment.getAccountConfigFile方法代码示例

本文整理汇总了Java中com.lody.virtual.os.VEnvironment.getAccountConfigFile方法的典型用法代码示例。如果您正苦于以下问题:Java VEnvironment.getAccountConfigFile方法的具体用法?Java VEnvironment.getAccountConfigFile怎么用?Java VEnvironment.getAccountConfigFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.lody.virtual.os.VEnvironment的用法示例。


在下文中一共展示了VEnvironment.getAccountConfigFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveAllAccounts

import com.lody.virtual.os.VEnvironment; //导入方法依赖的package包/类
/**
 * Serializing all accounts
 */
private void saveAllAccounts() {
	File accountFile = VEnvironment.getAccountConfigFile();
	Parcel dest = Parcel.obtain();
	try {
		dest.writeInt(1);
		List<VAccount> accounts = new ArrayList<>();
		for (int i = 0; i < this.accountsByUserId.size(); i++) {
			List<VAccount> list = this.accountsByUserId.valueAt(i);
			if (list != null) {
				accounts.addAll(list);
			}
		}
		dest.writeInt(accounts.size());
		for (VAccount account : accounts) {
			account.writeToParcel(dest, 0);
		}
		dest.writeLong(lastAccountChangeTime);
		FileOutputStream fileOutputStream = new FileOutputStream(accountFile);
		fileOutputStream.write(dest.marshall());
		fileOutputStream.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
	dest.recycle();
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:29,代码来源:VAccountManagerService.java

示例2: saveAllAccounts

import com.lody.virtual.os.VEnvironment; //导入方法依赖的package包/类
/**
 * Serializing all accounts
 */
private void saveAllAccounts() {
    File accountFile = VEnvironment.getAccountConfigFile();
    Parcel dest = Parcel.obtain();
    try {
        dest.writeInt(1);
        List<VAccount> accounts = new ArrayList<>();
        for (int i = 0; i < this.accountsByUserId.size(); i++) {
            List<VAccount> list = this.accountsByUserId.valueAt(i);
            if (list != null) {
                accounts.addAll(list);
            }
        }
        dest.writeInt(accounts.size());
        for (VAccount account : accounts) {
            account.writeToParcel(dest, 0);
        }
        dest.writeLong(lastAccountChangeTime);
        FileOutputStream fileOutputStream = new FileOutputStream(accountFile);
        fileOutputStream.write(dest.marshall());
        fileOutputStream.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    dest.recycle();
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:29,代码来源:VAccountManagerService.java

示例3: serializeAllAccounts

import com.lody.virtual.os.VEnvironment; //导入方法依赖的package包/类
/**
 * Serializing all accounts
 */
private void serializeAllAccounts() {
	File accountFile = VEnvironment.getAccountConfigFile();
	Parcel dest = Parcel.obtain();
	try {
		dest.writeInt(1);
		List<VAccount> accounts = new ArrayList<>();
		for (int i = 0; i < this.accountsByUserId.size(); i++) {
			List<VAccount> list = this.accountsByUserId.valueAt(i);
			if (list != null) {
				accounts.addAll(list);
			}
		}
		dest.writeInt(accounts.size());
		for (VAccount account : accounts) {
			account.writeToParcel(dest, 0);
		}
		dest.writeLong(lastAccountChangeTime);
		FileOutputStream fileOutputStream = new FileOutputStream(accountFile);
		fileOutputStream.write(dest.marshall());
		fileOutputStream.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
	dest.recycle();
}
 
开发者ID:codehz,项目名称:container,代码行数:29,代码来源:VAccountManagerService.java

示例4: readAllAccounts

import com.lody.virtual.os.VEnvironment; //导入方法依赖的package包/类
/**
 * Read all accounts from file.
 */
private void readAllAccounts() {
	File accountFile = VEnvironment.getAccountConfigFile();
	refreshAuthenticatorCache(null);
	if (accountFile.exists()) {
		accountsByUserId.clear();
		Parcel dest = Parcel.obtain();
		try {
			FileInputStream is = new FileInputStream(accountFile);
			byte[] bytes = new byte[(int) accountFile.length()];
			int readLength = is.read(bytes);
			is.close();
			if (readLength != bytes.length) {
				throw new IOException(String.format(Locale.ENGLISH, "Expect length %d, but got %d.", bytes.length, readLength));
			}
			dest.unmarshall(bytes, 0, bytes.length);
			dest.setDataPosition(0);
			dest.readInt(); // skip the magic
			int size = dest.readInt(); // the VAccount's size we need to read
			boolean invalid = false;
			while (size-- > 0) {
				VAccount account = new VAccount(dest);
				VLog.d(TAG, "Reading account : " + account.type);
				AuthenticatorInfo info = cache.authenticators.get(account.type);
				if (info != null) {
					List<VAccount> accounts = accountsByUserId.get(account.userId);
					if (accounts == null) {
						accounts = new ArrayList<>();
						accountsByUserId.put(account.userId, accounts);
					}
					accounts.add(account);
				} else {
					invalid = true;
				}
			}
			lastAccountChangeTime = dest.readLong();
			if (invalid) {
				saveAllAccounts();
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			dest.recycle();
		}
	}
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:49,代码来源:VAccountManagerService.java

示例5: readAllAccounts

import com.lody.virtual.os.VEnvironment; //导入方法依赖的package包/类
/**
 * Read all accounts from file.
 */
private void readAllAccounts() {
    File accountFile = VEnvironment.getAccountConfigFile();
    refreshAuthenticatorCache(null);
    if (accountFile.exists()) {
        accountsByUserId.clear();
        Parcel dest = Parcel.obtain();
        try {
            FileInputStream is = new FileInputStream(accountFile);
            byte[] bytes = new byte[(int) accountFile.length()];
            int readLength = is.read(bytes);
            is.close();
            if (readLength != bytes.length) {
                throw new IOException(String.format(Locale.ENGLISH, "Expect length %d, but got %d.", bytes.length, readLength));
            }
            dest.unmarshall(bytes, 0, bytes.length);
            dest.setDataPosition(0);
            dest.readInt(); // skip the magic
            int size = dest.readInt(); // the VAccount's size we need to read
            boolean invalid = false;
            while (size-- > 0) {
                VAccount account = new VAccount(dest);
                VLog.d(TAG, "Reading account : " + account.type);
                AuthenticatorInfo info = cache.authenticators.get(account.type);
                if (info != null) {
                    List<VAccount> accounts = accountsByUserId.get(account.userId);
                    if (accounts == null) {
                        accounts = new ArrayList<>();
                        accountsByUserId.put(account.userId, accounts);
                    }
                    accounts.add(account);
                } else {
                    invalid = true;
                }
            }
            lastAccountChangeTime = dest.readLong();
            if (invalid) {
                saveAllAccounts();
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            dest.recycle();
        }
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:49,代码来源:VAccountManagerService.java

示例6: deserializeAllAccounts

import com.lody.virtual.os.VEnvironment; //导入方法依赖的package包/类
/**
 * Read all accounts from file.
 */
private void deserializeAllAccounts() {
	File accountFile = VEnvironment.getAccountConfigFile();
	refreshAuthenticatorCache(null);
	if (accountFile.exists()) {
		accountsByUserId.clear();
           Parcel dest = Parcel.obtain();
           try {
               FileInputStream is = new FileInputStream(accountFile);
               byte[] bytes = new byte[(int) accountFile.length()];
               int readLength = is.read(bytes);
               is.close();
               if (readLength != bytes.length) {
                   throw new IOException(String.format("Expect length %d, but got %d.", bytes.length, readLength));
               }
               dest.unmarshall(bytes, 0, bytes.length);
               dest.setDataPosition(0);
               dest.readInt(); // skip the magic
               int size = dest.readInt(); // the VAccount's size we need to read
               boolean invalid = false;
               while (size-- > 0) {
                   VAccount account = new VAccount(dest);
				VLog.d(TAG, "Reading account : " + account.type);
                   AuthenticatorInfo info = cache.authenticators.get(account.type);
                   if (info != null) {
                       List<VAccount> accounts = accountsByUserId.get(account.userId);
                       if (accounts == null) {
                           accounts = new ArrayList<>();
                           accountsByUserId.put(account.userId, accounts);
                       }
                       accounts.add(account);
                   } else {
                       invalid = true;
                   }
               }
               lastAccountChangeTime = dest.readLong();
               if (invalid) {
                   serializeAllAccounts();
               }
           } catch (Exception e) {
               e.printStackTrace();
           } finally {
               dest.recycle();
           }
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:49,代码来源:VAccountManagerService.java


注:本文中的com.lody.virtual.os.VEnvironment.getAccountConfigFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。