1 String urlString = "http://api.douban.com/v2/book/search?q=python"; 2 try 3 { 4 URI uri = new URI(ur...
分类:
移动开发 时间:
2015-04-13 16:27:10
阅读次数:
150
public static void zipFiles(File[] srcfile,ServletOutputStream sos){ byte[] buf=new byte[1024]; try { //ZipOutputStream类:完成文件或文件夹的压缩 ...
分类:
编程语言 时间:
2015-04-13 16:21:25
阅读次数:
172
今天去逛论坛 时发现了一个很有趣的问题:谁能给我我解释一下这段程序的结果为什么是:2.而不是:3代码如下:class Test { public int aaa() { int x = 1; try { return ++x; } catch (Exception e) { } fina...
分类:
其他好文 时间:
2015-04-13 16:07:45
阅读次数:
131
Thread的run方法是不抛出任何检查型异常(checked exception)的,但是它自身却可能因为一个异常而被终止,导致这个线程的终结。最麻烦的是,在线程中抛出的异常即使使用try...catch也无法截获,因此可能导致一些问题出现,比如异常的时候无法回收一些系统资源,或者没有关闭当前的连...
分类:
编程语言 时间:
2015-04-13 12:34:46
阅读次数:
138
在Java 的异常处理机制中:如果抛出的是Exception异常的话,必须有try..catch..进行处理,属于checked exception。如果抛出的是RuntimeException异常的话,则不是必须进行try..catch..异常处理,发生异常之后将由JVM进行处理,属于unchec...
分类:
移动开发 时间:
2015-04-13 12:19:33
阅读次数:
122
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
Update (2015-02-12):
For C programmers: Try to solve it in-place in O(1...
分类:
其他好文 时间:
2015-04-13 11:01:46
阅读次数:
141
前天项目组遇到文件上传,对内存加大的问题。特意看了看相关知识,也对这个有一定的了解
try {
FileInputStream fis=new FileInputStream(new File("/home/saas/maven/maven.zip"));
BufferedInputStream bis=new BufferedInputStream(fis);
Fil...
分类:
其他好文 时间:
2015-04-13 10:58:27
阅读次数:
153
自定义一个截图函数,
public static void Snap(int x, int y, int width, int height)
{
try
{
//这段代码也可以实现截图
//Image image = new Bitmap(width, height);
//Graphics g = Graphics.FromI...
JS与Ajax(异步JS和XML):1.创建请求对象 function createRequest()function createRequest() { try { request = new XMLHttpRequest(); } catch (tryMS) { try { ...
分类:
Web程序 时间:
2015-04-12 16:14:37
阅读次数:
206
public static float getProcessCpuRate()
{
float totalCpuTime1 = getTotalCpuTime();
float processCpuTime1 = getAppCpuTime();
try
{
Thread.sleep(360);
...
分类:
移动开发 时间:
2015-04-12 12:05:27
阅读次数:
119