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());

+ Recent posts