Android Open Source - AndroidDBManageLibrary D B Asset Parser






From Project

Back to project page AndroidDBManageLibrary.

License

The source code is released under:

Apache License

If you think the Android project AndroidDBManageLibrary listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.bitsatom.dbmanage.parser;
//w  ww . j  av  a  2 s  .  c  om
import java.io.IOException;

import android.content.res.AssetManager;
import android.util.Log;

import com.bitsatom.dbmanage.android.DBManageException;
import com.example.dbmanage.data.VersionMetaStructure;

public class DBAssetParser {

  public static final String DB_ASSET_FOLDER = "db";
  
  private Object lock = new Object();

  public VersionMetaStructure parse(AssetManager assetManager) throws DBManageException {
    return parse(DB_ASSET_FOLDER, assetManager);
  }

  public VersionMetaStructure parse(String baseDBAssetFolder,
      AssetManager assetManager) throws DBManageException {
    VersionMetaStructure versions = new VersionMetaStructure(baseDBAssetFolder);
    try {
      synchronized (lock) {
        String[] assetList = assetManager.list(baseDBAssetFolder);
        for (String strVersion : assetList) {
          Log.d(DBAssetParser.class.toString(), "Version : " + strVersion);
          versions.addVersion(strVersion);
        }
      }
    } catch (IOException e) {
      throw new DBManageException("Error getting assets under '" + baseDBAssetFolder + "'");
    } catch (NumberFormatException e) {  
      throw new DBManageException("Invalid version number");
    }
    return versions;
  }

}




Java Source Code List

com.bitsatom.dbmanage.DBSyncService.java
com.bitsatom.dbmanage.MainActivity.java
com.bitsatom.dbmanage.android.DBHelper.java
com.bitsatom.dbmanage.android.DBManageException.java
com.bitsatom.dbmanage.parser.DBAssetParser.java
com.bitsatom.dbmanage.parser.SQLParser.java
com.example.dbmanage.data.VersionMetaStructure.java