`
lubacui
  • 浏览: 26215 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

用java写的一个文件操作类包

阅读更多
用java写的一个文件操作类包
关键字: 转

前几天仔细看了看java的I/O操作,呵呵。就写了一个操作文件的类包,功能有创建文件或目录,删除文件或目录,复制文件或目录,移动文件或目录,设置文件或目录属性,查看文件或目录大小。呵呵,功能比较简单,源代码为:
创建:
Java代码 
package fileOperation;  
 
import java.io.File;  
 
/**创建一个新的文件或目录 
* @author wakin 

*/ 
public class Create   
{  
    /** 
     * 根据路径名创建文件 
     * @param filePath 路径名 
     * @return 当创建文件成功后,返回true,否则返回false. 
     *  
     */ 
    public boolean createFile(String filePath) {  
        boolean isDone = false;  
        File file = new File(filePath);  
        if(file.exists())  
            throw new RuntimeException("File: "+filePath+" is already exist");  
        try {  
            isDone = file.createNewFile();  
        } catch (Exception e) {  
            // TODO: handle exception  
            e.printStackTrace();  
        }  
        return isDone;  
          
    }  
      
    /** 
     * 根据路径名创建目录 
     * @param filePath 路径名 
     * @return 当创建目录成功后,返回true,否则返回false. 
     */ 
    public boolean createDir(String filePath) {  
        boolean isDone = false;  
        File file = new File(filePath);  
        if(file.exists())  
            throw new RuntimeException("FileDirectory: "+filePath+" is already exist");  
        isDone = file.mkdirs();  
        return isDone;  
    }  
 


package fileOperation;

import java.io.File;

/**创建一个新的文件或目录
* @author wakin
*
*/
public class Create
{
/**
* 根据路径名创建文件
* @param filePath 路径名
* @return 当创建文件成功后,返回true,否则返回false.
*
*/
public boolean createFile(String filePath) {
boolean isDone = false;
File file = new File(filePath);
if(file.exists())
throw new RuntimeException("File: "+filePath+" is already exist");
try {
isDone = file.createNewFile();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return isDone;

}

/**
* 根据路径名创建目录
* @param filePath 路径名
* @return 当创建目录成功后,返回true,否则返回false.
*/
public boolean createDir(String filePath) {
boolean isDone = false;
File file = new File(filePath);
if(file.exists())
throw new RuntimeException("FileDirectory: "+filePath+" is already exist");
isDone = file.mkdirs();
return isDone;
}

}


删除:
Java代码 
package fileOperation;  
 
import java.io.File;  
import java.io.IOException;  
 
/** 
* 删除一个文件或目录 
* @author wakin 

*/ 
public class Delete   
{  
 
    /** 
     * 删除路径名所代表的文件。 
     * @param filePath 路径名 
     * @return 当文件成功删除,返回true,否则返回false. 
     */ 
    public boolean deleteFile(String filePath) throws IOException{  
        File file = new File(filePath);  
        if(file.exists()) {  
            file.delete();  
            //System.out.println(filePath+"文件已删除.");  
            return true;  
        }  
        else {  
            //System.out.println("逻辑错误:"+filePath+"文件不存在.");  
            return false;  
        }  
    }  
      
    /** 
     * 删除路径名所代表的目录 
     * @param filePath 路径名 
     * @return 当目录成功删除,返回true,否则返回false. 
     */ 
    public boolean deleteDir(String filePath) throws IOException{  
        boolean isDone = false;  
        File file = new File(filePath);  
        //判断是文件还是目录  
        if(file.exists()&&file.isDirectory()){  
            if(file.listFiles().length==0){  
                file.delete();  
                isDone = true;  
            }  
            else {  
                File [] delFiles = file.listFiles();  
                for(int i=0;i<delFiles.length;i++){  
                    if(delFiles[i].isDirectory()){  
                        deleteDir(delFiles[i].getAbsolutePath()); //递归调用deleteDir函数  
                    }  
                    else {  
                        delFiles[i].delete();  
                    }  
                }  
            }  
            //删除最后剩下的目录名。  
            deleteDir(filePath);  
            isDone = true;  
        }  
        else 
            return false;  
        return isDone;  
    }  
 


package fileOperation;

import java.io.File;
import java.io.IOException;

/**
* 删除一个文件或目录
* @author wakin
*
*/
public class Delete
{

/**
* 删除路径名所代表的文件。
* @param filePath 路径名
* @return 当文件成功删除,返回true,否则返回false.
*/
public boolean deleteFile(String filePath) throws IOException{
File file = new File(filePath);
if(file.exists()) {
file.delete();
//System.out.println(filePath+"文件已删除.");
return true;
}
else {
//System.out.println("逻辑错误:"+filePath+"文件不存在.");
return false;
}
}

/**
* 删除路径名所代表的目录
* @param filePath 路径名
* @return 当目录成功删除,返回true,否则返回false.
*/
public boolean deleteDir(String filePath) throws IOException{
boolean isDone = false;
File file = new File(filePath);
//判断是文件还是目录
if(file.exists()&&file.isDirectory()){
if(file.listFiles().length==0){
file.delete();
isDone = true;
}
else {
File [] delFiles = file.listFiles();
for(int i=0;i<delFiles.length;i++){
if(delFiles[i].isDirectory()){
deleteDir(delFiles[i].getAbsolutePath()); //递归调用deleteDir函数
}
else {
delFiles[i].delete();
}
}
}
//删除最后剩下的目录名。
deleteDir(filePath);
isDone = true;
}
else
return false;
return isDone;
}

}


复制:
Java代码 
package fileOperation;  
 
import java.io.BufferedInputStream;  
import java.io.BufferedOutputStream;  
import java.io.File;  
import java.io.FileInputStream;  
import java.io.FileOutputStream;  
import java.io.IOException;  
 
/** 
* 复制文件和文件夹工具类,能判断源文件不存在,源文件不可读,目标文件已经存在, 
* 目标路径不存在,目标路径不可写等情况  
* @author wakin 

*/ 
public class Copy   
{  
 
    /**根据源路径名和目标路径名复制文件。 
     *  
     * @param source_name 源路径名 
     * @param dest_name 目标路径名 
     * @param type  值为判断如果目标路径存在是否覆盖,1为覆盖旧的文件,2为不覆盖,操作取消。  
     * @return 当复制成功时返回1, 当目标文件存在且type值为2时返回2,其他情况返回0 
     * @throws IOException  发生I/O错误 
     */ 
    public int copyFile(  
            String source_name,  
            String dest_name,  
            int type) throws IOException {  
        int result = 0;  
        int byte_read;  
        byte [] buffer;  
        File source_file = new File(source_name);  
        File dest_file = new File(dest_name);  
        FileInputStream source = null;  
        BufferedInputStream bis = null;  
        BufferedOutputStream bos = null;  
        FileOutputStream dest = null;  
        try {  
            if(!source_file.exists() || !source_file.isFile()) //不存在  
                throw new RuntimeException("FileCopy: no such source file:"+source_name);  
            if(!source_file.canRead()) //不可读  
                throw new RuntimeException("FileCopy: source file"+source_name  
                        +"is unreadable");  
            if(dest_file.exists()) {  
                if(dest_file.isFile()) {  
                    if(type==1) {   
                        dest_file.delete();   //覆盖  
                        result = 1 ;  
                    }  
                    else if(type==2) {  
                        result = 2;  
                        return result;    //不覆盖 ,程序返回。  
                    }  
                }  
                else 
                    throw new RuntimeException("FileCopy: destination"+dest_name  
                            +"is not a file.");  
            }  
            else {  
                File parentDir = new File(dest_file.getParent());  //获得目录信息  
                if(!parentDir.exists()) {  
                    throw new RuntimeException("FileCopy: destination"+dest_name  
                            +"directory doesn't exist.");    //目录不存在  
                }  
                if(!parentDir.canWrite())  
                    throw new RuntimeException("FileCopy: destination"+dest_name  
                            +"is unwriteable.");            //目录不可写  
            }  
              
            //开始复制文件  
            //输入流  
            source = new FileInputStream(source_file);  
            bis = new BufferedInputStream(source);  
            //输出流  
            dest = new FileOutputStream(dest_file);  
            bos = new BufferedOutputStream(dest);  
            buffer = new byte[1024*5];  
            while((byte_read=bis.read(buffer))!=-1) {  
                bos.write(buffer, 0, byte_read);  
            }  
            result = 1;  
        } catch (IOException e) {  
            // TODO: handle exception  
            e.printStackTrace();  
        } finally {  
            if(source!=null){  
                bis.close();  
                source.close();  
            }  
            if(dest!=null) {  
                bos.flush();  
                bos.close();  
                dest.flush();  
                dest.close();  
            }  
        }  
        return result;  
          
    }  
      
    /**根据源路径名和目标路径名复制目录。 
     * 复制目录以复制文件为基础,通过递归复制子目录实现。 
     * @param source_name 源路径名 
     * @param dest_name 目标路径名 
     * @param type 值为判断如果目标路径存在是否覆盖,1为覆盖旧的目录,2为不覆盖,操作取消。 
     * @return 当复制成功时返回1, 当目标目录存在且type值为2时返回2,其他情况返回0 
     * @throws IOException  发生I/O错误 
     */ 
    public int copyDirectory(  
            String source_name,  
            String dest_name,  
            int type  
            ) throws IOException {  
        File source_file = new File(source_name);  
        File dest_file = new File(dest_name);  
        int result = 0;  
        Delete del = new Delete();         //用于删除目录文件  
        if(!source_file.exists()||source_file.isFile())  //不存在  
            throw new RuntimeException("DirCopy: no such dir"+source_name);  
        if(!source_file.canRead()) //不可读  
            throw new RuntimeException("DirCopy: source file"+source_name  
                    +"is unreadable");  
        if(dest_file.exists()) {  
            if(type==1) {  
                del.deleteDir(dest_name);   //覆盖  
                result = 1;  
            }  
            if(type==2) {  
                result = 2;                 //不覆盖  
                return result;  
            }  
        }  
        if(!dest_file.exists()) {  
            new File(dest_name).mkdirs(); //创建目标目录  
            File[] fileList = source_file.listFiles();  
            for(int i=0;i<fileList.length;i++){  
                System.out.println(fileList[i].getName());  
                if(fileList[i].isFile()){  
                    //用copyFile函数复制文件  
                    this.copyFile(  
                            source_name+"/"+fileList[i].getName(),   
                            dest_name+"/"+fileList[i].getName(),   
                            type);  
                }  
                else if(fileList[i].isDirectory()){  
                    //递归  
                    copyDirectory(  
                            source_name+"/"+fileList[i].getName(),   
                            dest_name+"/"+fileList[i].getName(), type);  
                }  
            }  
            result = 1;  
              
        }  
          
        return result;  
    }  


package fileOperation;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
* 复制文件和文件夹工具类,能判断源文件不存在,源文件不可读,目标文件已经存在,
* 目标路径不存在,目标路径不可写等情况
* @author wakin
*
*/
public class Copy
{

/**根据源路径名和目标路径名复制文件。
*
* @param source_name 源路径名
* @param dest_name 目标路径名
* @param type  值为判断如果目标路径存在是否覆盖,1为覆盖旧的文件,2为不覆盖,操作取消。
* @return 当复制成功时返回1, 当目标文件存在且type值为2时返回2,其他情况返回0
* @throws IOException  发生I/O错误
*/
public int copyFile(
String source_name,
String dest_name,
int type) throws IOException {
int result = 0;
int byte_read;
byte [] buffer;
File source_file = new File(source_name);
File dest_file = new File(dest_name);
FileInputStream source = null;
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
FileOutputStream dest = null;
try {
if(!source_file.exists() || !source_file.isFile()) //不存在
throw new RuntimeException("FileCopy: no such source file:"+source_name);
if(!source_file.canRead()) //不可读
throw new RuntimeException("FileCopy: source file"+source_name
+"is unreadable");
if(dest_file.exists()) {
if(dest_file.isFile()) {
if(type==1) {
dest_file.delete();   //覆盖
result = 1 ;
}
else if(type==2) {
result = 2;
return result;    //不覆盖 ,程序返回。
}
}
else
throw new RuntimeException("FileCopy: destination"+dest_name
+"is not a file.");
}
else {
File parentDir = new File(dest_file.getParent());  //获得目录信息
if(!parentDir.exists()) {
throw new RuntimeException("FileCopy: destination"+dest_name
+"directory doesn't exist.");    //目录不存在
}
if(!parentDir.canWrite())
throw new RuntimeException("FileCopy: destination"+dest_name
+"is unwriteable.");            //目录不可写
}

//开始复制文件
//输入流
source = new FileInputStream(source_file);
bis = new BufferedInputStream(source);
//输出流
dest = new FileOutputStream(dest_file);
bos = new BufferedOutputStream(dest);
buffer = new byte[1024*5];
while((byte_read=bis.read(buffer))!=-1) {
bos.write(buffer, 0, byte_read);
}
result = 1;
} catch (IOException e) {
// TODO: handle exception
e.printStackTrace();
} finally {
if(source!=null){
bis.close();
source.close();
}
if(dest!=null) {
bos.flush();
bos.close();
dest.flush();
dest.close();
}
}
return result;

}

/**根据源路径名和目标路径名复制目录。
* 复制目录以复制文件为基础,通过递归复制子目录实现。
* @param source_name 源路径名
* @param dest_name 目标路径名
* @param type 值为判断如果目标路径存在是否覆盖,1为覆盖旧的目录,2为不覆盖,操作取消。
* @return 当复制成功时返回1, 当目标目录存在且type值为2时返回2,其他情况返回0
* @throws IOException  发生I/O错误
*/
public int copyDirectory(
String source_name,
String dest_name,
int type
) throws IOException {
File source_file = new File(source_name);
File dest_file = new File(dest_name);
int result = 0;
Delete del = new Delete();         //用于删除目录文件
if(!source_file.exists()||source_file.isFile())  //不存在
throw new RuntimeException("DirCopy: no such dir"+source_name);
if(!source_file.canRead()) //不可读
throw new RuntimeException("DirCopy: source file"+source_name
+"is unreadable");
if(dest_file.exists()) {
if(type==1) {
del.deleteDir(dest_name);   //覆盖
result = 1;
}
if(type==2) {
result = 2;                 //不覆盖
return result;
}
}
if(!dest_file.exists()) {
new File(dest_name).mkdirs(); //创建目标目录
File[] fileList = source_file.listFiles();
for(int i=0;i<fileList.length;i++){
System.out.println(fileList[i].getName());
if(fileList[i].isFile()){
//用copyFile函数复制文件
this.copyFile(
source_name+"/"+fileList[i].getName(),
dest_name+"/"+fileList[i].getName(),
type);
}
else if(fileList[i].isDirectory()){
//递归
copyDirectory(
source_name+"/"+fileList[i].getName(),
dest_name+"/"+fileList[i].getName(), type);
}
}
result = 1;

}

return result;
}
}



移动:本来想用renameTo方法来实现的,但是发现这个方法有些问题。在我的博客里写明了,希望大家能指点一下。
Java代码 
package fileOperation;  
 
import java.io.File;  
import java.io.IOException;  
/** 
* 移动文件/目录,利用Delete类和Copy类来实现。 
* @author wakin 

*/ 
public class Move {  
    /** 
     * 利用Copy类的函数和Delete类来完成移动文件/目录的操作。 
     * @param source_name 源路径名 
     * @param dest_name   目标路径名 
     * @param type type  值为判断如果目标路径存在是否覆盖,1为覆盖旧的文件/目录,2为不覆盖操作取消。  
     * @return 当移动成功后返回1,当目标目录存在且type值为2时返回2,其他情况返回0 
     * @throws IOException  发生I/O错误 
     */ 
    public int move(String source_name,String dest_name,int type) throws IOException{  
        int result = 0;  
        Copy copy = new Copy();  
        Delete delete = new Delete();  
        File source_file = new File(source_name);  
        //File dest_file = new File(dest_name);  
        if(!source_file.exists())  
            throw new RuntimeException("FileMove: no such source file:"+source_name);  
        if(source_file.isFile()){  
            result = copy.copyFile(source_name, dest_name, type); //调用Copy类的copyFile函数  
            if(result ==1)  
                delete.deleteFile(source_name);   //调用Delete类的deleteFile函数删除源文件  
        }  
        else {  
            result = copy.copyDirectory(source_name, dest_name, type);//调用Copy类的copyDirectory函数  
            if(result == 1)  
                delete.deleteDir(source_name);    //调用Delete类的deleteDir函数删除源目录  
        }  
        return result;  
    }  


package fileOperation;

import java.io.File;
import java.io.IOException;
/**
* 移动文件/目录,利用Delete类和Copy类来实现。
* @author wakin
*
*/
public class Move {
/**
* 利用Copy类的函数和Delete类来完成移动文件/目录的操作。
* @param source_name 源路径名
* @param dest_name   目标路径名
* @param type type  值为判断如果目标路径存在是否覆盖,1为覆盖旧的文件/目录,2为不覆盖操作取消。
* @return 当移动成功后返回1,当目标目录存在且type值为2时返回2,其他情况返回0
* @throws IOException  发生I/O错误
*/
public int move(String source_name,String dest_name,int type) throws IOException{
int result = 0;
Copy copy = new Copy();
Delete delete = new Delete();
File source_file = new File(source_name);
//File dest_file = new File(dest_name);
if(!source_file.exists())
throw new RuntimeException("FileMove: no such source file:"+source_name);
if(source_file.isFile()){
result = copy.copyFile(source_name, dest_name, type); //调用Copy类的copyFile函数
if(result ==1)
delete.deleteFile(source_name);   //调用Delete类的deleteFile函数删除源文件
}
else {
result = copy.copyDirectory(source_name, dest_name, type);//调用Copy类的copyDirectory函数
if(result == 1)
delete.deleteDir(source_name);    //调用Delete类的deleteDir函数删除源目录
}
return result;
}
}



查看,设置属性:
Java代码 
package fileOperation;  
 
import java.io.File;  
/** 
* 查看,修改文件或目录的属性 
* @author wakin 

*/ 
public class Attribute {  
    /** 
     * 查看路径名所表示文件或目录的属性。 
     * @param fileName 路径名 
     */ 
    public void lookAttribute(String fileName) {  
        boolean canRead;  
        boolean canWrite;  
        boolean canExecute;  
        File file = new File(fileName);  
        if(!file.exists())  
            throw new RuntimeException("File:"+fileName+"is not exist");  
        canRead = file.canRead();  
        canWrite = file.canWrite();  
        canExecute = file.canExecute();  
        System.out.println("Can read:"+canRead+"    Can write:"+canWrite+"  Can Execute:"+canExecute);  
    }  
    /** 
     * 设置路径名所表示的文件或目录的的属性。?部分功能可能在windows下无效。 
     * @param fileName 路径名 
     * @param readable 是否可读 
     * @param writable 是否可写 
     * @param executable 是否可执行 
     * @param ownerOnly  是否用户独享 
     * @return 属性设置成功,返回true,否则返回false 
     */ 
    public boolean setAttribute(  
            String fileName,  
            boolean readable,  
            boolean writable,  
            boolean executable,  
            boolean ownerOnly)  
    {  
        boolean isDone = false;  
        File file = new File(fileName);  
        isDone = file.setReadable(readable, ownerOnly)   
                && file.setWritable(writable, ownerOnly)  
                && file.setExecutable(executable, ownerOnly);  
        return isDone;  
    }  


package fileOperation;

import java.io.File;
/**
* 查看,修改文件或目录的属性
* @author wakin
*
*/
public class Attribute {
/**
* 查看路径名所表示文件或目录的属性。
* @param fileName 路径名
*/
public void lookAttribute(String fileName) {
boolean canRead;
boolean canWrite;
boolean canExecute;
File file = new File(fileName);
if(!file.exists())
throw new RuntimeException("File:"+fileName+"is not exist");
canRead = file.canRead();
canWrite = file.canWrite();
canExecute = file.canExecute();
System.out.println("Can read:"+canRead+" Can write:"+canWrite+" Can Execute:"+canExecute);
}
/**
* 设置路径名所表示的文件或目录的的属性。?部分功能可能在windows下无效。
* @param fileName 路径名
* @param readable 是否可读
* @param writable 是否可写
* @param executable 是否可执行
* @param ownerOnly  是否用户独享
* @return 属性设置成功,返回true,否则返回false
*/
public boolean setAttribute(
String fileName,
boolean readable,
boolean writable,
boolean executable,
boolean ownerOnly)
{
boolean isDone = false;
File file = new File(fileName);
isDone = file.setReadable(readable, ownerOnly)
&& file.setWritable(writable, ownerOnly)
&& file.setExecutable(executable, ownerOnly);
return isDone;
}
}


查看大小:
Java代码 
package fileOperation;  
 
import java.io.File;  
import java.io.IOException;  
/** 
* 计算文件或目录的空间大小。 
* @author wakin 

*/ 
public class Size {  
    /** 
     * 计算路径名代表的文件或目录所占空间的大小。 
     * @param fileName 路径名 
     * @return 所占字节数 
     * @throws IOException 发生I/O错误 
     */ 
    public static long getSize(String fileName) throws IOException {  
        long result = 0;  
        File file = new File(fileName);  
        if(!file.exists())  
            throw new RuntimeException("No such source file:"+fileName);  
        if(file.isFile()){  
            return file.length();  
        }  
        else {  
            String [] FileList = file.list();  
            for(int i =0;i<FileList.length;i++) {  
                result += getSize(fileName+"/"+FileList[i]);   //迭代  
            }  
        }  
        return result;  
    }  

分享到:
评论

相关推荐

    java实现对文件的各种操作的工具类.md

    # java实现对文件的各种操作的工具类 ## 可以实现的操作有: 1. 删除单个文件 2. 删除文件夹及文件夹下的文件 3. 使用文件流对单个文件进行复制 4. 复制整个文件夹内容(包含子文件夹中的所有内容) 5. ...

    自己写的java对xml文件操作的类

    自己写的java对xml文件操作的类 包含了对xml文件的读取,对属性和值的读取 对元素的增加,删除

    java文件操作的工具类

    此文档为java中操作File对象的一个通用工具类,包含了byte数组和File类的相互转换

    java 操作xml文件(包含xml文件和对应jar包)

    压缩包中有一个项目(项目中包含操作xml文件的类和对应的xml文件)、一个用于操作xml文件的jar包,用于操作xml文件,并且获得list集合。

    java csv文件读取工具类

    一个非常好用的csv文件操作工具

    java操作word文件工具类级dell文件

    java操作word文件工具类级dell文件,dell文件包含32位级64位文件

    Java包与文件操作

    编写Base类、Base类的子类Derived类和主类testData类,测试包与访问权限控制符的应用

    Java文件处理工具类--FileUtil

    import java.io.*; /** * FileUtil. Simple file operation class. * * @author BeanSoft * */ public class FileUtil { /** * The buffer. */ protected static byte buf[] = new byte[1024]; /**...

    Java实现将多目录多层级文件打成ZIP包,以及解压ZIP包

    包含了使用的jar包,以及一个Java类,实现了使用Java对多目录多层级的文件进行打包,以及对ZIP包进行解压缩的操作。

    JAVA WEB框架,java网站一个模块只用写一个文件

    JAVA WEB框架,java网站一个模块只用写一个文件 以前的servlet在现在的开发中已经不怎么常见,因为操作起来比较原始和麻烦。有些人就是不安于现状去改造它。 做得好的有Struts,Hybernate,Spring那么这些框架都是很...

    Java读写Excel的jar包

     通过java操作excel表格的工具类库  支持Excel 95-2000的所有版本  生成Excel 2000标准格式  支持字体、数字、日期操作  能够修饰单元格属性  支持图像和图表  应该说以上功能已经能够大致满足我们的需要。最...

    java源码包---java 源码 大量 实例

    5个目标文件,演示Address EJB的实现,创建一个EJB测试客户端,得到名字上下文,查询jndi名,通过强制转型得到Home接口,getInitialContext()函数返回一个经过初始化的上下文,用client的getHome()函数调用Home接口...

    java源码包2

    5个目标文件,演示Address EJB的实现,创建一个EJB测试客户端,得到名字上下文,查询jndi名,通过强制转型得到Home接口,getInitialContext()函数返回一个经过初始化的上下文,用client的getHome()函数调用Home接口...

    java源码包4

    5个目标文件,演示Address EJB的实现,创建一个EJB测试客户端,得到名字上下文,查询jndi名,通过强制转型得到Home接口,getInitialContext()函数返回一个经过初始化的上下文,用client的getHome()函数调用Home接口...

    Java调用Zip类批量压缩多个文件.rar

    Java调用Zip类批量压缩多个文件,此前有一个是压缩单个文件,也可参考,相关代码中可找到此源码。  public class ZipDemo extends JFrame{  JFileChooser fileChooser; //文件选择器  JList fileList; //待...

    java 编写文件上传类简单易用

    这两个步骤主要的操作有两个,一个是从一个数组中找出另一个数组的位置,类似于 String 类中的 indexOf 的功能,另一个是从一个数组中提取出另一个数组, 类似于 String 类中的 substring 的功能,为此我们可以专门...

    java源码包3

    5个目标文件,演示Address EJB的实现,创建一个EJB测试客户端,得到名字上下文,查询jndi名,通过强制转型得到Home接口,getInitialContext()函数返回一个经过初始化的上下文,用client的getHome()函数调用Home接口...

    java实现sftp操作工具类

    依赖类包在我的sftp包下载下提供 版权声明:本工具类为个人兴趣基于chnSftp编写的应用,个人版权在先,后因各个办公环境无相关软件也有相关的个人使用,和办公环境内的推广使用,也欢迎互联网使用,如涉及相关环境...

Global site tag (gtag.js) - Google Analytics