当前位置: 首页>>代码示例>>Java>>正文


Java IOException.printStackTrace方法代码示例

本文整理汇总了Java中java.io.IOException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java IOException.printStackTrace方法的具体用法?Java IOException.printStackTrace怎么用?Java IOException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.IOException的用法示例。


在下文中一共展示了IOException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: boluxsCatalog

import java.io.IOException; //导入方法依赖的package包/类
private static Map boluxsCatalog(Map map, String url) {
  try {
    List data = new ArrayList();
    Document document = Jsoup
        .connect(url)
        .userAgent(FormatUtil.USER_AGENT_PC)
        .get();
    Element body = document.body();
    Elements catalogEles = body.getElementsByClass("article_texttitleb").last().getElementsByTag("li");
    for (Element catalogE : catalogEles) {
      Map<String, Object> _map = new HashMap<>();
      _map.put("catalog", catalogE.text());
      _map.put("href", url + catalogE.getElementsByTag("a").attr("href"));
      data.add(_map);
    }
    String cover = body.getElementsByClass("img").first().getElementsByTag("img").first().attr("src");
    map.put("data", data);
    map.put("cover", cover);
    map.put("lastChapter", ((Map) data.get(data.size() - 1)).get("catalog").toString());
  } catch (IOException e) {
    e.printStackTrace();
  }
  return map;
}
 
开发者ID:tomoya92,项目名称:android-apps,代码行数:25,代码来源:JsoupUtil.java

示例2: getCommentsNum

import java.io.IOException; //导入方法依赖的package包/类
private int getCommentsNum(File file) {
    if (!file.exists())
        return 0;
    try {
        int comments = 0;
        String currentLine;

        BufferedReader reader = new BufferedReader(new FileReader(file));

        while ((currentLine = reader.readLine()) != null)
            if (currentLine.startsWith("#"))
                comments++;

        reader.close();
        return comments;
    } catch (IOException e) {
        e.printStackTrace();
        return 0;
    }
}
 
开发者ID:LimitedDani,项目名称:Achtbaan,代码行数:21,代码来源:ConfigManager.java

示例3: main

import java.io.IOException; //导入方法依赖的package包/类
public static void main(String[] args) {
    String rootPath = "hdfs://nameservice1";
    Path p = new Path(rootPath + "/tmp/file.txt");
    Configuration conf = new Configuration();
    conf.addResource("core-site.xml");
    conf.addResource("hdfs-site.xml");
    conf.addResource("yarn-site.xml");
    try {
        // 没开kerberos,注释下面两行
        UserGroupInformation.setConfiguration(conf);
        UserGroupInformation.loginUserFromKeytab("[email protected]","E:\\星环\\hdfs.keytab");
        FileSystem fs = p.getFileSystem(conf);
        boolean b = fs.delete(p, true);
        System.out.println(b);
        fs.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Transwarp-DE,项目名称:Transwarp-Sample-Code,代码行数:20,代码来源:Delete.java

示例4: connect

import java.io.IOException; //导入方法依赖的package包/类
public static SocketChannel connect(SocketAddress remote, final int timeoutMillis) {
    SocketChannel sc = null;
    try {
        sc = SocketChannel.open();
        sc.configureBlocking(true);
        sc.socket().setSoLinger(false, -1);
        sc.socket().setTcpNoDelay(true);
        sc.socket().setReceiveBufferSize(1024 * 64);
        sc.socket().setSendBufferSize(1024 * 64);
        sc.socket().connect(remote, timeoutMillis);
        sc.configureBlocking(false);
        return sc;
    }
    catch (Exception e) {
        if (sc != null) {
            try {
                sc.close();
            }
            catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    }

    return null;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:27,代码来源:RemotingUtil.java

示例5: searchClasspath

import java.io.IOException; //导入方法依赖的package包/类
private List<RpcMethodDefinition> searchClasspath(String serviceName) {

        logger.info("Scanning classpath for proto files of {}", serviceName);

        List<RpcMethodDefinition> rpcMethodDefinitions = new ArrayList<>();
        String classpath = System.getProperty("java.class.path");
        String jars[] = classpath.split(":");
        for (String jar : jars) {
            try {
                rpcMethodDefinitions = searchJar(jar, serviceName);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (!rpcMethodDefinitions.isEmpty()) {
                break;
            }
        }
        return rpcMethodDefinitions;
    }
 
开发者ID:Sixt,项目名称:ja-micro,代码行数:20,代码来源:RpcMethodScanner.java

示例6: updateHubTemplate

import java.io.IOException; //导入方法依赖的package包/类
public boolean updateHubTemplate()
{
    try
    {
        hubTemplate = (SimpleGameTemplate) instance.getTemplateManager().getTemplateByID("hub");
        if (hubTemplate == null)
            throw new IOException("No Hub template found !");
    } catch (IOException e)
    {
        e.printStackTrace();
        instance.getLogger().severe("Add one and reboot HydroServer or no hub will be start on the network!");
        return false;
    }

    if (balancer == null)
    {
        balancer = new BalancingTask(instance, this);
    }

    if (!balancer.isAlive())
    {
        balancer.start();
    }
    return true;
}
 
开发者ID:SamaGames,项目名称:Hydroangeas,代码行数:26,代码来源:HubBalancer.java

示例7: readSignature

import java.io.IOException; //导入方法依赖的package包/类
public static void readSignature(VPackage pkg) {
    File signatureFile = VEnvironment.getSignatureFile(pkg.packageName);
    if (!signatureFile.exists()) {
        return;
    }
    Parcel p = Parcel.obtain();
    try {
        FileInputStream fis = new FileInputStream(signatureFile);
        byte[] bytes = FileUtils.toByteArray(fis);
        fis.close();
        p.unmarshall(bytes, 0, bytes.length);
        p.setDataPosition(0);
        pkg.mSignatures = p.createTypedArray(Signature.CREATOR);
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        p.recycle();
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:20,代码来源:PackageParserEx.java

示例8: saveEpisode

import java.io.IOException; //导入方法依赖的package包/类
public void saveEpisode() {
	try {
		BufferedWriter w = new BufferedWriter(new FileWriter(Data.currentEpisodePath + File.separatorChar + Data.currentEpisodeFile.getName()));
		
		w.write(Data.currentEpisodeName + "\n");
		w.write(Data.currentEpisodePath + "\n");
		
		for (File f : Data.episodeFiles) {
			w.write(f.getAbsolutePath() + "\n");
		}
		
		w.flush();
		w.close();
		
		Data.episodeChanged = false;
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:Detea,项目名称:PekaED,代码行数:21,代码来源:EpisodePanel.java

示例9: getOrcFiles

import java.io.IOException; //导入方法依赖的package包/类
/**
 * Get all ORC files present in directory for the specified table and partition/bucket. The ORC
 * files returned are in ascending order of the (insertion) time-partition and sequence-id within
 * the time-partition.
 *
 * @param orcDir the ORC store directory
 * @param args the arguments in order: table-name, bucket-id, time-partition-id
 * @return the list of all ORC files
 */
private String[] getOrcFiles(final String orcDir, final String fileExt, final String... args) {
  try {
    FileSystem fileSystem = FileSystem.get(conf);
    Path distributedPath = new Path(Paths.get(orcDir, args).toString());
    ArrayList<String> filePathStrings = new ArrayList<>();
    if (fileSystem.exists(distributedPath)) {
      RemoteIterator<LocatedFileStatus> fileListItr = fileSystem.listFiles(distributedPath, true);
      while (fileListItr != null && fileListItr.hasNext()) {
        LocatedFileStatus file = fileListItr.next();
        if (!file.getPath().getName().endsWith(fileExt)) {
          // exclude CRC files
          filePathStrings.add(file.getPath().toUri().toString());
        }
      }

      Collections.sort(filePathStrings);
    }
    String[] retArray = new String[filePathStrings.size()];
    filePathStrings.toArray(retArray);
    return retArray;
  } catch (IOException e) {
    e.printStackTrace();
  }
  return new String[0];
}
 
开发者ID:ampool,项目名称:monarch,代码行数:35,代码来源:AbstractTierStoreReader.java

示例10: create

import java.io.IOException; //导入方法依赖的package包/类
@Override
public void create() {
	batch = new SpriteBatch();
	cam = new Camera(screenX, screenY);
	batch.setProjectionMatrix(cam.camera.combined);
	batch.enableBlending();
	try {
		save = new Save();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

	this.setScreen(new MainMenu(this));

}
 
开发者ID:MusicDev33,项目名称:JGame,代码行数:17,代码来源:JGame.java

示例11: skip

import java.io.IOException; //导入方法依赖的package包/类
private void skip(int bytes){
	try {
		this.stream.read(new byte[bytes]);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:8,代码来源:PTInputStream.java

示例12: showHTML

import java.io.IOException; //导入方法依赖的package包/类
private void showHTML(String title, String path) {
        JScrollPane scrollPane = new JScrollPane();

/*  fixme Bug with HTML embedded URL Link
        HTMLtextPane.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseReleased(MouseEvent e) {
                super.mouseReleased(e);
                // createFontResizePopup().setVisible(true);
                createFontResizePopup().show(HTMLtextPane, 10, 10);
            }
        });
*/
        //    HTMLtextPane.add(createFontResizePopup());
        URL url;
        url = MFMUI_Resources.getInstance().ResourceURLs().get(path);
        try {
            HTMLtextPane.setPage(url);
        } catch (IOException e) {
            e.printStackTrace();
        }
        HTMLtextPane.setPreferredSize(new Dimension(850, 600));
        scrollPane.setViewportView(HTMLtextPane);
        // NOTE we do all of this to have a resizable dialog.
        Object[] array = {
                new JLabel(title),
                scrollPane,
        };
        JOptionPane pane = new JOptionPane(array, JOptionPane.PLAIN_MESSAGE);
        JDialog dialog = pane.createDialog(mainFrame, "");
        dialog.setLocation(150, 150);
        dialog.setResizable(true);
        dialog.setVisible(true);
    }
 
开发者ID:phweda,项目名称:MFM,代码行数:35,代码来源:MFMController.java

示例13: onCreate

import java.io.IOException; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    _appSettings = new AppSettings(this);
    _contextUtils = new ActivityUtils(this);
    _contextUtils.setAppLanguage(_appSettings.getLanguage());
    if (_appSettings.isOverviewStatusBarHidden()) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    if (!_appSettings.isLoadLastDirectoryAtStartup()) {
        _appSettings.setLastOpenedDirectory(null);
    }
    setContentView(R.layout.main__activity);
    ButterKnife.bind(this);
    setSupportActionBar(_toolbar);

    optShowRate();

    try {
        if (_appSettings.isAppCurrentVersionFirstStart(true)) {
            SimpleMarkdownParser smp = SimpleMarkdownParser.get().setDefaultSmpFilter(SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW);
            String html = "";
            html += smp.parse(getString(R.string.copyright_license_text_official).replace("\n", "  \n"), "").getHtml();
            html += "<br/><br/><br/><big><big>" + getString(R.string.changelog) + "</big></big><br/>" + smp.parse(getResources().openRawResource(R.raw.changelog), "", SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW, SimpleMarkdownParser.FILTER_CHANGELOG);
            html += "<br/><br/><br/><big><big>" + getString(R.string.licenses) + "</big></big><br/>" + smp.parse(getResources().openRawResource(R.raw.licenses_3rd_party), "").getHtml();
            ActivityUtils _au = new ActivityUtils(this);
            _au.showDialogWithHtmlTextView(R.string.licenses, html);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    // Setup viewpager
    removeShiftMode(_bottomNav);
    _viewPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    _viewPager.setAdapter(_viewPagerAdapter);
    _bottomNav.setOnNavigationItemSelectedListener(this);
}
 
开发者ID:gsantner,项目名称:markor,代码行数:39,代码来源:MainActivity.java

示例14: parse

import java.io.IOException; //导入方法依赖的package包/类
private EditorConfig parse(IDocument document) {
	final ErrorHandler errorHandler = ErrorHandler.THROWING;
	EditorConfigModelHandler handler = new LocationAwareModelHandler(PropertyTypeRegistry.default_(),
			Version.CURRENT, errorHandler);
	EditorConfigParser parser = EditorConfigParser.default_();
	try {
		parser.parse(Resources.ofString(EditorConfigConstants.EDITORCONFIG, document.get()), handler, errorHandler);
	} catch (IOException e) {
		e.printStackTrace();
	}
	return handler.getEditorConfig();
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:13,代码来源:EditorConfigContentProvider.java

示例15: dumpLog

import java.io.IOException; //导入方法依赖的package包/类
static InputStream dumpLog(){
    try {
        Process process = Runtime.getRuntime().exec("logcat *:D -d");
        Runtime.getRuntime().exec("logcat -c");
        return process.getInputStream();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:stdnull,项目名称:RunMap,代码行数:11,代码来源:LogDumper.java


注:本文中的java.io.IOException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。