SpringMVC3AndHibernate3 & springMVC集成DWR http://p…
不静之心

分类:Java
Java基于Socket文件传输示例
Java基于Socket文件传输示例 原文:http://www.blogjava.net/sterning/…
java调用dos命令
java调用dos命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
package com; import java.io.BufferedReader; import java.io.InputStreamReader; public class CommonUtils { public static String exeCMD1(String cmd){ cmd = "cmd.exe /c "+cmd; Process process = null; StringBuffer sb = new StringBuffer(); BufferedReader reader = null; try { process = Runtime.getRuntime().exec(cmd); reader = new BufferedReader(new InputStreamReader(process.getInputStream())); while(true){ String str = reader.readLine(); if(str==null) break; System.out.println(str); sb.append(str); } process.destroy(); } catch (Exception e) { // TODO: handle exception } return sb.toString(); } public static String exeCMD2(String cmd){ String[] args = new String[]{"cmd","/c",cmd}; Process process = null; StringBuffer sb = new StringBuffer(); BufferedReader reader = null; try { process = Runtime.getRuntime().exec(args); reader = new BufferedReader(new InputStreamReader(process.getInputStream())); while(true){ String str = reader.readLine(); if(str==null) break; System.out.println(str); sb.append(str); } process.destroy(); } catch (Exception e) { // TODO: handle exception } return sb.toString(); } public static void main(String[] args){ CommonUtils.exeCMD1("tree"); CommonUtils.exeCMD1("tree"); } } |
JAVA socket编程实例
JAVA socket编程实例 http://daoyongyu.iteye.com/blog/265677 …
ServerSocket & Socket
服务器: 以应用程序的方式启动: Server1Main.java [crayon-6821711279bc5…
利用 JAVA 操作 EXCEL 文件
利用 JAVA 操作 EXCEL 文件 http://www.ibm.com/developerworks/c…
从文件得到ByteArrayOutputStream
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
public static ByteArrayOutputStream getOutputStream(String filePath){ File file = new File(filePath); FileInputStream in = null; ByteArrayOutputStream out = new ByteArrayOutputStream(); try { in = new FileInputStream(file); byte[] buffer = new byte[in.available()]; in.read(buffer); out.write(buffer); } catch (Exception e) { e.printStackTrace(); }finally{ try { if(in!=null) in.close(); } catch (Exception e2) { } } return out; } |
Convert HTML to PDF using iText
http://www.rgagnon.com/javadetails/java-html-to-pdf-usi…
Java实现HTML代码生成PDF文档
参考: http://blog.csdn.net/zdtwyjp/article/details/576935…
java调用存储过程和函数
存储过程:有参数
1 2 3 4 5 6 7 8 9 10 11 12 13 |
String rSet=null; CallableStatement cStatement=null; try { cStatement=connection.prepareCall("{Call sellTicketPROC(?,?,?,?,?,?,?)}"); cStatement.setString(1, lineID); cStatement.setString(2, beginStation); cStatement.setString(3, endStation); cStatement.setString(4, date); cStatement.setString(5, TrainNum); cStatement.setString(6, seatTyle); cStatement.registerOutParameter(7,Types.VARCHAR); cStatement.execute(); rs=cStatement.getString(7);//得到输出结果 |
调用函数: [crayon…
Java反射经典实例 Java Reflection Cookbook
http://orangewhy.iteye.com/blog/56011 Java提供了一套机制来动态执行方…
JAVA 随机字符串生成方法
http://hi.baidu.com/yinfuqing666/blog/item/b9c3a0d21917…
Java InputStream 的mark 和reset操作
http://hi.baidu.com/lee_eva/blog/item/e60803dba2d00ad1b…
Blob、InputStream、byte 互转
Blob、InputStream、byte 互转 本文URL: http://blog.csdn.net/su…
带有排序和过滤功能的JTable
http://blog.csdn.net/vanessa219/article/details/2795899…
用JAVA轻松操作properties文件
http://www.blogjava.net/action/archive/2006/08/21/64804…
使用BeanUtils时,Date类型值为空的解决方法
解决办法参考:http://hi.baidu.com/fcp_bd/blog/item/0e632783c08…
FileInputStream,FileOutputStream文件拷贝之性能比较
http://www.iteye.com/topic/409525 [crayon-682171127bae6…
java创建zip文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
public String createZip(String zipFileName,List<String> fileList,String speSymbols){ ZipOutputStream out = null; File zipFile = new File(zipFileName); try { if(!zipFile.exists()){ zipFile.createNewFile(); }else{ zipFile.delete(); zipFile.createNewFile(); } out = new ZipOutputStream(new FileOutputStream(zipFile)); for(String filePath: fileList){ File file = new File(filePath); ZipEntry ent = new ZipEntry(file.getName()); FileInputStream ins = new FileInputStream (file); out.putNextEntry(ent); int b = 0; while((b=ins.read())!=-1){ out.write(b); } ins.close(); } out.close(); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return null; } |
java追加内容到文件末尾
http://www.java3z.com/cwbwebhome/article/article5/51290…
java读取图片长宽问题
参考 Java代码 http://www.java3z.com/cwbwebhome/article/arti…
hashmap,hashtabl,hashtree,linkedhashmap区别分析
java为数据结构中的映射定义了一个接口java.util.Map;它有四个实现类,分别是HashMap Ha…
jxl得到一个字符串的宽度
1 2 3 |
JLabel jlabel = new JLabel(test_str); FontMetrics fm = jlabel.getFontMetrics(new java.awt.Font("Times New Roman",java.awt.Font.PLAIN, 12)); System.out.println("string width="+fm.stringWidth(test_str)); |
jxl读取行高度的问题
1 |
sheet.getRowView(0).getDimension() |
这一段代码就是读取行高度。 我现在要放一段数…
程序即时读取日志文件
http://xieruilin.iteye.com/blog/716031 [crayon-68217112…