CoVer_App/app/src/main/java/com/example/cover_a01/StorageReadWrite.java
/**
     * Loads data from given filename.
     */
Loads data from given filename.
Loads data from given filename .
static String loadFromFile(Context context, String filename) {
        String userData = null;
        try {
            InputStream inputStream = context.openFileInput(filename);
            if ( inputStream != null ) {
                InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
                BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
                String receiveString =  bufferedReader.readLine();
                inputStream.close();
                userData = receiveString;
            }
        }
        catch (FileNotFoundException e) {
            Log.e(TAG, "File not found: " + e.toString());
        } catch (IOException e) {
            Log.e(TAG, "Cannot read file: " + e.toString());
        }
        return userData;
    }
static String loadFromFile ( Context context , String filename ) { String userData = null ; try { InputStream inputStream = context . openFileInput ( filename ) ; if ( inputStream != null ) { InputStreamReader inputStreamReader = new InputStreamReader ( inputStream ) ; BufferedReader bufferedReader = new BufferedReader ( inputStreamReader ) ; String receiveString = bufferedReader . readLine ( ) ; inputStream . close ( ) ; userData = receiveString ; } } catch ( FileNotFoundException e ) { Log . e ( TAG , "File not found: " + e . toString ( ) ) ; } catch ( IOException e ) { Log . e ( TAG , "Cannot read file: " + e . toString ( ) ) ; } return userData ; }
Loads data from given filename.
Loads data from given filename .