本文整理匯總了Java中java.io.FileNotFoundException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java FileNotFoundException.printStackTrace方法的具體用法?Java FileNotFoundException.printStackTrace怎麽用?Java FileNotFoundException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.io.FileNotFoundException
的用法示例。
在下文中一共展示了FileNotFoundException.printStackTrace方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadInstructions
import java.io.FileNotFoundException; //導入方法依賴的package包/類
public void loadInstructions(File instructionsFile)
{
setIncremental(true);
try {
fr = new FileReader(instructionsFile);
} catch (FileNotFoundException fnfEx) {
JOptionPane.showMessageDialog(null,fnfEx.getMessage(),"Error",JOptionPane.ERROR_MESSAGE);
System.err.println("cxf network file not found");
fnfEx.printStackTrace();
}
br = new BufferedReader(fr);
Token token;
instructionTokens = new ArrayList<Token>();
while ((token = getNextToken()) != null)
instructionTokens.add(token);
return;
}
示例2: a
import java.io.FileNotFoundException; //導入方法依賴的package包/類
protected static final String a(Bitmap bitmap, String str, String str2) {
File file = new File(str);
if (!file.exists()) {
file.mkdirs();
}
String stringBuffer = new StringBuffer(str).append(str2).toString();
File file2 = new File(stringBuffer);
if (file2.exists()) {
file2.delete();
}
if (bitmap != null) {
try {
OutputStream fileOutputStream = new FileOutputStream(file2);
bitmap.compress(CompressFormat.JPEG, 80, fileOutputStream);
fileOutputStream.flush();
fileOutputStream.close();
bitmap.recycle();
return stringBuffer;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
}
}
return null;
}
示例3: makeOutputStreamForStreaming
import java.io.FileNotFoundException; //導入方法依賴的package包/類
public BufferedOutputStream makeOutputStreamForStreaming(String str) {
try {
try {
try {
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(this.bн043D043Dн043D043D.openFileOutput(getUniqueFileName(str) + HAPTIC_STORAGE_FILENAME, 0));
if (((b0425Х042504250425Х + b04250425042504250425Х) * b0425Х042504250425Х) % bХХХХХ0425 == bХ0425ХХХ0425()) {
return bufferedOutputStream;
}
b0425Х042504250425Х = b0425ХХХХ0425();
bХ0425042504250425Х = 15;
return bufferedOutputStream;
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
} catch (Exception e2) {
throw e2;
}
} catch (Exception e22) {
throw e22;
}
}
示例4: removeStopWordsRemoveAll
import java.io.FileNotFoundException; //導入方法依賴的package包/類
public static void removeStopWordsRemoveAll(String text){
//******************EXAMPLE WITH REMOVE ALL *******************************************************************************************
try {
out.println(text);
Scanner stopWordList = new Scanner(new File("C://Jenn Personal//Packt Data Science//Chapter 3 Data Cleaning//stopwords.txt"));
TreeSet<String> stopWords = new TreeSet<String>();
while(stopWordList.hasNextLine()){
stopWords.add(stopWordList.nextLine());
}
ArrayList<String> dirtyText = new ArrayList<String>(Arrays.asList(text.split(" ")));
dirtyText.removeAll(stopWords);
out.println("Clean words: ");
for(String x : dirtyText){
out.print(x + " ");
}
out.println();
stopWordList.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
開發者ID:PacktPublishing,項目名稱:Machine-Learning-End-to-Endguide-for-Java-developers,代碼行數:24,代碼來源:SimpleStringCleaning.java
示例5: saveBitmap
import java.io.FileNotFoundException; //導入方法依賴的package包/類
/**
* 將圖片保存在指定路徑中
*
* @param bitmap
* @param descPath
*/
public static void saveBitmap(Bitmap bitmap, String descPath) {
File file = new File(descPath);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists()) {
try {
bitmap.compress(CompressFormat.JPEG, 30, new FileOutputStream(
file));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
if (null != bitmap) {
bitmap.recycle();
bitmap = null;
}
}
示例6: openTrustStore
import java.io.FileNotFoundException; //導入方法依賴的package包/類
/**
* This method open a TrustStore. It returns true if the password is correct.
*
* @param trustStoreFile the TrustStore name
* @param trustStorePassword the TrustStore password
* @return true, if successful
*/
public boolean openTrustStore(File trustStoreFile, String trustStorePassword) {
if (trustStoreFile != null && trustStoreFile.exists()) {
try {
trustStoreInputStream = new FileInputStream(trustStoreFile);
init(trustStoreFile, trustStorePassword);
return openTrustStoreFromStream(trustStoreInputStream, trustStorePassword);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
return false;
}
示例7: getFileInputStream
import java.io.FileNotFoundException; //導入方法依賴的package包/類
private InputStream getFileInputStream(String fileName) {
try {
FileInputStream fis = new FileInputStream(fileName);
return fis;
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return null;
}
示例8: getDebugOutputPrintStream
import java.io.FileNotFoundException; //導入方法依賴的package包/類
public static PrintStream getDebugOutputPrintStream(final String dir, final String filename) {
String path;
if (System.getenv("TEST_DIR") != null) {
path = System.getenv("TEST_DIR") + File.separator + rootPath + dir;
} else {
String temp_rootPath = "/tmp/";
if (rootPath == null && HStoreConf.isInitialized()) {
synchronized (BuildDirectoryUtils.class) {
if (rootPath == null) {
rootPath = HStoreConf.singleton().global.temp_dir +
File.separator +
"debugoutput/";
}
} // SYNCH
}
if (rootPath != null) temp_rootPath = rootPath;
assert(temp_rootPath != null);
path = temp_rootPath + dir;
}
File d = new File(path);
d.mkdirs();
//if (!success) return null;
String filepath = path + "/" + filename;
File f = new File(filepath);
if (f.exists()) f.delete();
//if (f.canWrite() == false) return null;
try {
return new PrintStream(f);
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
}
示例9: uploadFile
import java.io.FileNotFoundException; //導入方法依賴的package包/類
/**
* 上傳文件
* @Title: uploadFile
* @param file
* @param fileName
* @return void 返回類型
*/
public static void uploadFile(File file, String fileName) {
try {
if (!file.exists()) { // 如果文件的路徑不存在就創建路徑
file.getParentFile().mkdirs();
}
InputStream bis = new FileInputStream(file);
uploadFile(bis, fileName);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
示例10: getBitmapFromUri
import java.io.FileNotFoundException; //導入方法依賴的package包/類
public static Bitmap getBitmapFromUri(Context context, Uri uri, Options options) {
Bitmap bitmap = null;
InputStream is = null;
try {
is = context.getContentResolver().openInputStream(uri);
bitmap = BitmapFactory.decodeStream(is, null, options);
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (FileNotFoundException e2) {
e2.printStackTrace();
if (is != null) {
try {
is.close();
} catch (IOException e3) {
e3.printStackTrace();
}
}
} catch (Throwable th) {
if (is != null) {
try {
is.close();
} catch (IOException e32) {
e32.printStackTrace();
}
}
}
return bitmap;
}
示例11: message
import java.io.FileNotFoundException; //導入方法依賴的package包/類
public B message(File file){
try {
return message(new FileInputStream(file));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return null;
}
示例12: initFromFile
import java.io.FileNotFoundException; //導入方法依賴的package包/類
private void initFromFile(File file) {
try {
toIniFile(new BufferedReader(new FileReader(file)));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
示例13: openContentInputStream
import java.io.FileNotFoundException; //導入方法依賴的package包/類
/**
* Return a {@link BufferedInputStream} from the given uri or null if an exception is thrown
*
* @param context
* @param uri
* @return the {@link InputStream} of the given path. null if file is not found
*/
static InputStream openContentInputStream( Context context, Uri uri ) {
try {
return context.getContentResolver().openInputStream( uri );
} catch ( FileNotFoundException e ) {
e.printStackTrace();
}
return null;
}
示例14: onActivityResult
import java.io.FileNotFoundException; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode){
case TAKE_PHOTO:
if (resultCode==RESULT_OK){
try{
//將拍攝的照片顯示出來
Bitmap bitmap= BitmapFactory.decodeStream(getContentResolver().openInputStream(imageUri));
picture.setImageBitmap(bitmap);
}catch (FileNotFoundException e){
e.printStackTrace();
}
}
break;
case CHOOSE_PHOTO:
if (resultCode==RESULT_OK){
//判斷手機係統版本號
if (Build.VERSION.SDK_INT>=19){
//4.4及以上係統使用這個方法處理圖片
handleImageOnKitkat(data);
}
else {
//4.4及以下係統使用此方法處理圖片
handleImageBeforeKitKat(data);
}
}
default:
break;
}
}
示例15: saveToContentProvider
import java.io.FileNotFoundException; //導入方法依賴的package包/類
private static void saveToContentProvider(File file,Activity activity){
// 其次把文件插入到係統圖庫
try {
MediaStore.Images.Media.insertImage(activity.getContentResolver(), file.getAbsolutePath(),file.getName(), null);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
// 最後通知圖庫更新
activity.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(file)));
}