@ 주제 

파일다운로드 구현 

 

@ 목적 

 파일다운로드를 간단하게 구현해본다.

 

@ 내용

 

import java.io.FileInputStream;

import java.io.FileOutputStream;

 

public class IoTest {

    public static void main(String[] args) {

        try {

            FileInputStream fis = new FileInputStream("C:\\Users\\Genie\\Desktop\\test1.xlsx");

            FileOutputStream fos = new FileOutputStream("C:\\Users\\Genie\\Desktop\\test2.xlsx");

            

            int readData = -1;

            // fis.read() 는 읽어오는 값이 있으면 정수값을 준다 .

            while((readData = fis.read()) != -1) {

                fos.write(readData);

            }

            

            

            fis.close();

            fos.close();

            

            

            

        } catch (Exception e) {

            // TODO: handle exception

        }

    }

}

 

 

+ Recent posts