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);
}
精彩评论