Android Open Source - GeoCarDroid File Manager






From Project

Back to project page GeoCarDroid.

License

The source code is released under:

GNU General Public License

If you think the Android project GeoCarDroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.geocar.geocarconnect;
/*from w w  w .jav  a 2  s.c  om*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;

import android.os.Environment;

public class FileManager {
  private static final String SUB_DIR = "GPS";
  
  public static ArrayList<FileInfo> getFileList() {
    ArrayList<FileInfo> fileList = new ArrayList<FileInfo>();
    return fileList;
  }

  public static BufferedWriter getNewOutputFile() {
    return getNewOutputFile("GPS.txt"); 
  }

  public static BufferedWriter getNewOutputFile(String fileName) {
    BufferedWriter out = null;
    String fullPath = Environment.getExternalStorageDirectory() 
      + "/" + SUB_DIR + "/" + fileName;
    File file = new File(fullPath);
      
    try {
      if(!file.exists()) {
        file.getParentFile().mkdirs();
        file.createNewFile();
      }
      out = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(file)));
    } catch (Exception e) {
      e.printStackTrace();
    }
    return out;
  }

  public static boolean writeFileToSDCard( BufferedWriter out, String data) {
    try {
      out.write(data);
      out.flush();
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }

  public static boolean close( BufferedWriter out ){
    try {
      out.close();
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }
  
  public static boolean close( BufferedReader in ){
    try {
      in.close();
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }
    return true;
  }
  
  public static BufferedReader getInputFile(String fileName) {
    BufferedReader in = null;
    String fullPath = Environment.getExternalStorageDirectory() 
      + "/" + SUB_DIR + "/" + fileName;
    File file = new File(fullPath);
    try {
      in = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
    } catch (Exception e) {
      e.printStackTrace();
    }
    return in;
  }
}




Java Source Code List

com.geocar.bluetooth.AlertType.java
com.geocar.bluetooth.BthDeviceManager.java
com.geocar.bluetooth.ConnectThread.java
com.geocar.bluetooth.ConnectedThread.java
com.geocar.bluetooth.ConnectionHandler.java
com.geocar.bluetooth.GeoSendDataThread.java
com.geocar.bluetooth.SocketHandler.java
com.geocar.geocarconnect.FileInfo.java
com.geocar.geocarconnect.FileManager.java
com.geocar.geocarconnect.GeoCarAlert.java
com.geocar.geocarconnect.MainActivity.java
com.geocar.geocarconnect.PrefActivity.java
com.geocar.geocarconnect.Settings.java
com.geocar.geocarconnect.StartMenu.java
com.geocar.sms.SmsListener.java