zoukankan      html  css  js  c++  java
  • 文件上传下载 java阅读


    import java.io.FileInputStream;
    import java.io.FileReader;

    import java.io.FileOutputStream;

    public class Caozuo {
        
        
        //在线阅读
        public  void  yuedu(String lujing) throws Exception{
            FileReader fr=new FileReader(lujing);
            int date;
            while((date=fr.read())!=-1){    
                System.out.print((char)date);
            }
            fr.close();
            System.out.println();
            
        }
        
        //下载
        public void xiazai(Wuxia wx,int index) throws Exception{
            String lujing=wx.list.get(index).getLujing();
            String xiazailj="E:\U1\"+wx.list.get(index).getName()+".txt";
                FileInputStream fis=new FileInputStream(lujing);
                FileOutputStream fos=new FileOutputStream(xiazailj);
                int date;
                byte[] bytes=new byte[1024];
                while((date=fis.read(bytes, 0, bytes.length))!=-1){
                    fos.write(bytes, 0, date);
                }
                fis.close();
               fos.close();
               System.out.println("文件的名字是"+wx.list.get(index).getName());
                System.out.println("文件的下载路径是"+xiazailj);
                
        }
        //上传
        public void shangchuan(Wuxia wx,String daichuan,String name) throws Exception{
            
            String xiazailj="D:\U1\"+name+".txt";
                FileInputStream fis=new FileInputStream(daichuan);
                FileOutputStream fos=new FileOutputStream(xiazailj);
                int date;
                byte[] bytes=new byte[1024];
                while((date=fis.read(bytes, 0, bytes.length))!=-1){
                    fos.write(bytes, 0, date);
                }
                fis.close();
               fos.close();
              
                
        }
        
        
    }

  • 相关阅读:
    CV
    Flutter 概览
    spaCy 基本使用
    图像读写、属性
    图像原理
    NLP 实战
    NLTK 相似性度量
    NLTK 停用词、罕见词
    NLTK 词干提取、词形还原
    NLTK 基本操作
  • 原文地址:https://www.cnblogs.com/anshuo/p/5384678.html
Copyright © 2011-2022 走看看