本文整理汇总了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)));
}