Read file via FileInputStream - Android App

Android examples for App:Resource

Description

Read file via FileInputStream

Demo Code


//package com.java2s;
import java.io.FileInputStream;

import java.io.IOException;

public class Main {
    static String[] getCredentials(FileInputStream fis) {
        byte[] inputData = new byte[50];
        String[] data = null;// ww  w.  ja v  a  2 s .co m
        int length = 0;
        try {
            length = fis.read(inputData, 0, 50);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (length > 0) {
            String inputString = new String(inputData);
            data = inputString.split(";");
        }
        return data;
    }
}

Related Tutorials