List of usage examples for java.io FileNotFoundException printStackTrace
public void printStackTrace()
From source file:Main.java
public static void writeToFile(File file, String content) { try {//from ww w . j av a2s. com PrintWriter out = new PrintWriter(file); out.println(content); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
From source file:Main.java
public static Bitmap getImageByFile(String uri) { try {/* w w w .j a v a2 s.c o m*/ FileInputStream fis = new FileInputStream(uri); return BitmapFactory.decodeStream(fis); } catch (FileNotFoundException e) { e.printStackTrace(); return null; } }
From source file:Main.java
public static Bitmap decodeBitmap(String url) { try {//from w w w.j a v a2 s. c o m FileInputStream fis = new FileInputStream(url); return BitmapFactory.decodeStream(fis); } catch (FileNotFoundException e) { e.printStackTrace(); return null; } }
From source file:Main.java
public static void writeTofiles(Context context, Bitmap bitmap, String filename) { BufferedOutputStream outputStream = null; try {// w ww . j a va 2s . com outputStream = new BufferedOutputStream(context.openFileOutput(filename, Context.MODE_PRIVATE)); bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream); } catch (FileNotFoundException e) { e.printStackTrace(); } }
From source file:Main.java
public static Bitmap getLoacalBitmap(String url) { try {//from ww w. j a v a 2s.co m FileInputStream fis = new FileInputStream(url); return BitmapFactory.decodeStream(fis); } catch (FileNotFoundException e) { e.printStackTrace(); return null; } }
From source file:Main.java
public static Bitmap loadBitmapFromStorage(String path) { try {// ww w . ja va2 s .c o m FileInputStream is = new FileInputStream(path); Bitmap bitmap = BitmapFactory.decodeStream(is); return bitmap; } catch (FileNotFoundException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static OutputStream getOutputStream(File file) { try {/*from w w w . jav a 2 s. co m*/ OutputStream out = new BufferedOutputStream(new FileOutputStream(file)); return out; } catch (FileNotFoundException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static boolean saveBitmap(File file, Bitmap bitmap) { if (file == null || bitmap == null) return false; try {//from w ww. ja v a 2s . co m BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); return bitmap.compress(CompressFormat.JPEG, 100, out); } catch (FileNotFoundException e) { e.printStackTrace(); return false; } }
From source file:Main.java
public static void writeFile(Context context, String text, String fileName) { try {//from w w w.j a v a 2 s . c o m FileOutputStream fos = context.openFileOutput(fileName, Context.MODE_APPEND); fos.write(text.getBytes()); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
From source file:Main.java
public static Bitmap loadImageFromStorage(String path) { try {// w ww.ja v a 2 s. co m File f = new File(path, "profile.jpg"); Bitmap b = BitmapFactory.decodeStream(new FileInputStream(f)); return b; } catch (FileNotFoundException e) { e.printStackTrace(); return null; } }