quiz icon indicating copy to clipboard operation
quiz copied to clipboard

quick refactor java parser

Open fforbeck opened this issue 8 years ago • 0 comments

  1. Removed comments
  2. Set the file attribute as final
  3. Created a constructor to get the file path and create the new file
  4. Removed set and get file methods
  5. Switch from String to StringBuilder
  6. Switch while > 0 to while != -1
  7. Added withUnicode flag to do all the work in one method and avoid duplicated code
  8. Deleted getContentWithoutUnicode
  9. Added try-finally-close for the input/output stream
  10. Check if the content var is not empty before write the content
  11. Check if the file exists before write the content
  12. Removed the for loop to write content as byte array
  13. Added sync for both methods
  14. Created Filter interface with 2 implementations: NoFilter and UnicodeFilter
  15. Switch from java6 try-finaly to java 7 try-with-resources

TODO

  1. Rename var i to fis on getContent method
  2. Check if file exists before try to read the content on saveContent method

fforbeck avatar May 21 '16 18:05 fforbeck