1 package com.android.tests.javaprojecttest.javaproject3; 2 3 import java.io.BufferedReader; 4 import java.io.IOException; 5 import java.io.InputStream; 6 import java.io.InputStreamReader; 7 8 public class JavaProject3 { 9 getContent()10 public static String getContent() { 11 InputStream input = JavaProject3.class.getResourceAsStream("/com/android/tests/javaprojecttest/javaproject3/JavaProject3.txt"); 12 if (input == null) { 13 return "FAILED TO FIND JavaProject3.txt"; 14 } 15 16 BufferedReader reader = null; 17 try { 18 reader = new BufferedReader(new InputStreamReader(input, "UTF-8")); 19 20 return reader.readLine(); 21 } catch (IOException e) { 22 } finally { 23 if (reader != null) { 24 try { 25 reader.close(); 26 } catch (IOException e) { 27 } 28 } 29 } 30 31 return "FAILED TO READ CONTENT"; 32 } 33 } 34