Android Open Source - Alfred4Android Index Data






From Project

Back to project page Alfred4Android.

License

The source code is released under:

Apache License

If you think the Android project Alfred4Android 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.toraleap.collimator.data;
//from  w  w  w  .jav a  2 s  . c o m
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import com.toraleap.collimator.util.Unicode2Alpha;

/**
 * ???????????????????????????????????????????????????
 * @author    uestc.Mobius <mobius@toraleap.com>
 * @version  2010.1025
 */
final class IndexData {
  
  private static final int version = 1;
  String[] name;
  String[] path;
  String[] nameAlpha;
  String[] pathAlpha;
  long[] size;
  long[] time;
  long indexTime;
  long availableSpace;
  
  int length() {
    if (name == null) {
      return 0;
    } else {
      return name.length;
    }
  }
  
  void read(DataInputStream in) throws IOException, ClassNotFoundException, DifferentVersionException {
    String lastPath = null;
    int ver = in.readInt();
    if (ver != version) throw new DifferentVersionException();
    indexTime = in.readLong();
    availableSpace = in.readLong();
    int count = in.readInt();
    name = new String[count];
    path = new String[count];
    nameAlpha = new String[count];
    pathAlpha = new String[count];
    size = new long[count];
    time = new long[count];
    for (int i = 0; i < count; i++) {
      name[i] = in.readUTF();
      if (in.readBoolean() == false) {
        path[i] = in.readUTF();
        lastPath = path[i];
      } else {
        path[i] = lastPath;
      }
      nameAlpha[i] = Unicode2Alpha.toAlpha(name[i]);
      pathAlpha[i] = Unicode2Alpha.toAlpha(path[i]);
      size[i] = in.readLong();
      time[i] = in.readLong();
    }
  }
  
  void write(DataOutputStream out) throws IOException {
    String lastPath = null;
    out.writeInt(version);
    out.writeLong(indexTime);
    out.writeLong(availableSpace);
    out.writeInt(name.length);
    for (int i = 0; i < name.length; i++) {
      out.writeUTF(name[i]);
      if (path[i] == lastPath) {
        out.writeBoolean(true);
      } else {
        out.writeBoolean(false);
        out.writeUTF(path[i]);
        lastPath = path[i];
      }
      out.writeLong(size[i]);
      out.writeLong(time[i]);
    }
  }
  
  @SuppressWarnings("serial")
  public class DifferentVersionException extends Exception {
    public DifferentVersionException() {
      super("Different version detected.");
    }
    public DifferentVersionException(String detailMessage) {
      super(detailMessage);
    }
  }
}




Java Source Code List

android.media.MediaMetadataRetriever.java
com.toraleap.collimator.AppSearchActivity.java
com.toraleap.collimator.GlobalContext.java
com.toraleap.collimator.HelpActivity.java
com.toraleap.collimator.PrefsActivity.java
com.toraleap.collimator.SearchActivity.java
com.toraleap.collimator.ShortcutActivity.java
com.toraleap.collimator.bll.FileScannerService.java
com.toraleap.collimator.bll.TagGenerator.java
com.toraleap.collimator.dal.DBColumns.java
com.toraleap.collimator.dal.DBHelper.java
com.toraleap.collimator.dal.DBOperation.java
com.toraleap.collimator.data.Expression.java
com.toraleap.collimator.data.IndexData.java
com.toraleap.collimator.data.IndexLoader.java
com.toraleap.collimator.data.Index.java
com.toraleap.collimator.data.Match.java
com.toraleap.collimator.data.Matcher.java
com.toraleap.collimator.data.Sorter.java
com.toraleap.collimator.ext.GlobalProvider.java
com.toraleap.collimator.ext.Playlist.java
com.toraleap.collimator.model.BaseTag.java
com.toraleap.collimator.ui.FloatingDialog.java
com.toraleap.collimator.ui.MatchAdapter.java
com.toraleap.collimator.util.DigestUtil.java
com.toraleap.collimator.util.FileInfo.java
com.toraleap.collimator.util.MimeTypeMap.java
com.toraleap.collimator.util.RecursiveFileObserver.java
com.toraleap.collimator.util.ShortcutHelper.java
com.toraleap.collimator.util.SoftCache.java
com.toraleap.collimator.util.ThumbnailUtil.java
com.toraleap.collimator.util.Unicode2Alpha.java