开发者

manually read a file in the files directory

Friends, My application has to get current gps position in every seconds and write this data as byte array to a file in files directory. To check the data in that file I tried to open mnually. B开发者_JS百科ut i couldn't open. How can i read the file. The file is a text file


private static String readFileAsString(String file) throws IOException {
    byte[] bytes = new byte[(int) new File(file).length()];
    BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file));
    stream.read(bytes);
    return new String(bytes);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜