Replace System.getProperty("line.separator") to System.lineSeparator()
Replace ByteArrayOuputStream to FastByteArrayOutputStream.