易截截图软件、单文件、免安装、纯绿色、仅160KB

Java中对文件的操作

Java中对文件的操作
java中提供了io类库,可以轻松的用java实现对文件的各种操作。下面就来说一下如何用java来实现这些操作。
1。新建目录
<%@
page contentType="text/html;charset=gb2312"%>
<%
String
filePath="c:/aaa/";
filePath=filePath.toString();//中文转换
java.io.File
myFilePath=new
java.io.File(filePath);
if(!myFilePath.exists())
myFilePath.mkdir();
%>
2。新建文件
<%@
page contentType="text/html;charset=gb2312"%>
<%@ page
import="java.io.*" %>
<%
String
filePath="c:/哈哈.txt";
filePath=filePath.toString();
File
myFilePath=new
File(filePath);
if(!myFilePath.exists())
myFilePath.createNewFile();
FileWriter
resultFile=new FileWriter(myFilePath);
PrintWriter myFile=new
PrintWriter(resultFile);
String strContent =
"中文测试".toString();
myFile.println(strContent);
resultFile.close();
%>
3。删除文件
<%@
page contentType="text/html;charset=gb2312"%>
<%
String
filePath="c:/支出证明单.xls";
filePath=filePath.toString();
java.io.File
myDelFile=new
java.io.File(filePath);
myDelFile.delete();
%>
4。文件拷贝
<%@
page contentType="text/html; charset=gb2312" %>
<%@ page
import="java.io.*" %>
<%
int bytesum=0;
int
byteread=0;
file://读到流中
InputStream inStream=new
FileInputStream("c:/aaa.doc");
FileOutputStream fs=new FileOutputStream(
"d:/aaa.doc");byte[] buffer =new byte[1444];
int length;
while
((byteread=inStream.read(buffer))!=-1)
{
out.println("<DT><B>"+byteread+"</B></DT>");
bytesum+=byteread;
System.out.println(bytesum);
fs.write(buffer,0,byteread);
}
inStream.close();
%>
5。整个文件夹拷贝
<%@
page contentType="text/html;charset=gb2312"%>
<%@ page
import="java.io.*" %>
<%String url1="C:/aaa";
String
url2="d:/java/";
(new File(url2)).mkdirs();
File[] file=(new
File(url1)).listFiles();
for(int
i=0;i<file.length;i++){
if(file.isFile()){
file.toString();
FileInp


相关文档:

IBM FileNet Content Java API 简介

2008 年 6 月 24 日
原文地址: http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0806wangys/
本文介绍 IBM FileNet P8 4.0 Platform 提供的 Content Java API。首先对 FileNet P8 Content Engine 和 API 进行概要介绍, 并说明了一些基本概念,随后详细介绍了 FileNet Content Engine提供的基于 EJB ......

java中如何使用amcharts


最近公司碰到需要用图表的形式显示一些数据,我就开始到网上查询,查到了jfreechart和amcharts,这两者我都实现过了,jfreechart最后生成图片,但是图片效果不是我想要的,然后又研究amcharts 它的效果确实很好,而且官方网站上还有好些例子可供下载,网址是:www.amcharts.com
(想要完成一个amcharts图形需要swfobjects. ......

Java Web Start

Java Web Start技术可以让用户从浏览器上下载下来java jar包,然后在本地打开jar包运行程序,之后浏览器关闭与否都没有关系了,浏览器的作用就是从网上下载jar包,然后启动程序
1.首先先下载Tomcat,作为存放发布程序的sever。当打开网页登陆那个sever的界面后,点击链接先下载存在sever里面的jar包到本地电脑,然后自动运� ......

针对java加密防止反编译的办法

    众所周知,java开发语言提供了很方便的开发平台,开发出来的程序很容易在不同的平台上被移植,现在越来越多的人使用它来开发软件,与.net语言并驾齐驱。
    Java有它方便的一面,同时也给开发者带来了一个不小的烦恼,就是保护程序代码变得困难,因为java语言编译和代码执行的特 ......

Chapter 04 _Array(core Java摘要)

一、数组是什么?
1.基本概念:
Definition:数组就是相同类型元素的线性集合。
Array is a collection of the same data.
An array is object.
对数组的理解:
数组是一个对象,是一个指向数组的引用对象。
2.Syntax
Array Copy
二、为什么要使用数组? ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号