Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.DataInputStream;

import java.io.IOException;
import java.io.InputStream;

import java.util.HashMap;

public class Main {

    public static HashMap<String, String> load(InputStream is) {
        String appInfo[] = null;
        HashMap<String, String> appMap = new HashMap<String, String>();
        try {
            DataInputStream bis = new DataInputStream(is);
            String txt = "";
            do {
                txt = bis.readLine();
                if (txt != null) {
                    txt = new String(txt.trim().getBytes("ISO-8859-1"), "UTF-8");
                    ;
                    appInfo = txt.split(":");
                    appMap.put(appInfo[0], appInfo[1]);
                }
            } while (txt != null && !"".equals(txt));
            bis.readLine();

        } catch (IOException e) {

        } finally {
            return appMap;
        }
    }
}