Android Open Source - droidling L I D Stats






From Project

Back to project page droidling.

License

The source code is released under:

Copyright (c) 2012 Keith Trnka Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softwa...

If you think the Android project droidling 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.github.ktrnka.droidling;
//w ww.j a  v  a2 s .  co m
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;

/**
 * Wrapper around the stats from InterpersonalActivity to load/save.
 */
public class LIDStats {
    ArrayList<Item> list;

    public LIDStats() {
        list = new ArrayList<Item>();
    }

    public LIDStats(FileInputStream in) throws IOException {
        readFrom(in);
    }

    private void readFrom(FileInputStream in) throws IOException {
        DataInputStream dataIn = new DataInputStream(new BufferedInputStream(in));

        int numItems = dataIn.readInt();
        list = new ArrayList<Item>(numItems);

        for (int i = 0; i < numItems; i++) {
            add(dataIn.readUTF(), dataIn.readUTF());
        }

        dataIn.close();
    }

    public void writeTo(FileOutputStream out) throws IOException {
        DataOutputStream dataOut = new DataOutputStream(new BufferedOutputStream(out));

        dataOut.writeInt(list.size());

        for (Item item : list) {
            dataOut.writeUTF(item.name.toString());
            dataOut.writeUTF(item.details.toString());
        }

        dataOut.close();
    }

    public void add(CharSequence name, CharSequence details) {
        list.add(new Item(name, details));
    }

    public static class Item {
        CharSequence name;
        CharSequence details;

        public Item(CharSequence name, CharSequence details) {
            this.name = name;
            this.details = details;
        }
    }
}




Java Source Code List

com.github.ktrnka.droidling.AboutActivity.java
com.github.ktrnka.droidling.AboutInterpersonalActivity.java
com.github.ktrnka.droidling.AboutLangIDActivity.java
com.github.ktrnka.droidling.AboutPersonalActivity.java
com.github.ktrnka.droidling.CorpusStats.java
com.github.ktrnka.droidling.DateDistribution.java
com.github.ktrnka.droidling.DiagnosticActivity.java
com.github.ktrnka.droidling.ExtendedApplication.java
com.github.ktrnka.droidling.GraphCard.java
com.github.ktrnka.droidling.ImageAdapter.java
com.github.ktrnka.droidling.InterpersonalActivity.java
com.github.ktrnka.droidling.InterpersonalCard.java
com.github.ktrnka.droidling.InterpersonalSingleStats.java
com.github.ktrnka.droidling.InterpersonalStats.java
com.github.ktrnka.droidling.LIDStats.java
com.github.ktrnka.droidling.LanguageIdentificationActivity.java
com.github.ktrnka.droidling.LanguageIdentifier.java
com.github.ktrnka.droidling.MainActivity.java
com.github.ktrnka.droidling.PersonalActivity.java
com.github.ktrnka.droidling.PersonalStats.java
com.github.ktrnka.droidling.RefreshableActivity.java
com.github.ktrnka.droidling.ShareableCard.java
com.github.ktrnka.droidling.Sms.java
com.github.ktrnka.droidling.Tokenizer.java
com.github.ktrnka.droidling.WordDistribution.java
com.github.ktrnka.droidling.helpers.AsyncDrawable.java
com.github.ktrnka.droidling.helpers.BitmapLoaderTask.java
com.github.ktrnka.droidling.helpers.Util.java