Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.util.Log;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {
    public static String readSingleLineFromFile(InputStream in, int lineNumber) {
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String line = "";

        try {
            for (int i = 0; i < lineNumber - 1; ++i) {
                br.readLine();
            }

            line = br.readLine();
        } catch (IOException e) {
            Log.e("LineParseError", "Could not read line");
        }

        try {
            in.reset();
        } catch (IOException e) {
            Log.e("LineParser", "Could not reset InputStream");
        }
        return line;
    }
}