엑셀은 버전에 따라 확장자가 xls, xlsx로 나뉘는데 두 확장자 모두 사용이 가능하도록 하려면 Workbook 클래스를 사용한다. (Workbook, Sheet, Cell) (추가. 해당 셀의 null 체크를 하려면 cell == null은 기본으로 체크하고, cell.getCellType == Cell.CELL_TYPE_BLANK도 사용한다.) (추가2. 엑셀에서 셀을 삭제 할 때, 대부분의 사용자들은 삭제할 셀 영역을 선택하고 키보드의 delete키를 이용하여 삭제를 한다. 이게 셀의 null체크시 문제가 될 수 있다. 단순하게 delete로 셀의 내용을 삭제하면 이것은 말 그대로 내용만 삭제한 것 뿐이다. 즉, 개발자 입장에서 조금 더 쉽게 풀자면 셀 객체의 내용을 빈 공백으로 세팅한 것이다. ..
String imgSourcePath= "test_image.jpg"; // 원본 이미지 파일명 (경로 포함) String imgTargetPath= "test_imageNew.jpg"; // 새 이미지 파일명(경로 포함) String imgFormat = "jpg"; // 새 이미지 포맷. jpg, gif 등 int newWidth = 640; // 새 이미지 넓이 int newHeight = 360; // 새 이미지 높이 imgResize(imgSourcePath, newImgFilePath, imgFormat, newWidth, newHeight); /** * Image Resize */ public void imgResize(String imgSourcePath, String imgTargetPa..
public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); System.out.println("URL 입력 : "); String spec = sc.nextLine(); System.out.println("저장 할 경로 입력 : "); String savePath = sc.nextLine(); URL url = new URL(spec); InputStream is = url.openStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is,"UTF-8")); // BufferedWriter bw = new Buffere..
public static void main(String[] args) throws IOException { long startTime = System.currentTimeMillis(); String path = 파일경로; // String copyPath = 파일경로; String copyPath = 파일경로; //1차 스트림 파일장치에 직접 연결되면서 2차 스트림의 생성자로 주입이 될 스트림. // FileInputStream fis = null; // FileOutputStream fos = null; //2차스트림 중 Buffer의 기능을 가진 스트림을 사용하여 속도향상. BufferedInputStream bis = null; BufferedOutputStream bos = null; try {..
public static void main(String[] args) throws IOException { long startTime = System.currentTimeMillis(); String path = "파일경로"; String copyPath = "파일경로"; FileInputStream fis = null; FileOutputStream fos = null; try { fis = new FileInputStream(path); fos = new FileOutputStream(copyPath); int res = -1; //파일의 끝에 도달하면 -1반환 while((res = fis.read()) != -1){ //읽어오는 메서드(read) fos.write(res); //읽어온 값을 작성하..