관리 메뉴

프리랜서 사짜

JAVA File 읽기 본문

JAVA/JAVA

JAVA File 읽기

사짜 참을인 2013.06.26 11:00

TEXT FILE READ

 

   BufferedReader bufferReader = new BufferedReader( new FileReader( new File (folder.toString() + "/" + strFileName ) ) );
   StringBuilder sb = new StringBuilder();
   String line;
   while ( (line = bufferReader.readLine() ) != null ) {
    sb.append( line );
   }
   bufferReader.close();

 

 

 

 

IMAGE, BINARY FILE READ

 

BufferedImage image = ImageIO.read(new File( folder.toString() + "/" + strFileName ) );
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   ImageIO.write(image, "png", baos);
   String encodedImage = Base64.encode(baos.toByteArray());

0 Comments
댓글쓰기 폼