Created
September 5, 2021 17:00
-
-
Save Tomut0/67b116092e63b69b3fadea9d3d8a56c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String encode(File file, String charset) throws IOException { | |
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); | |
ByteArrayOutputStream buf = new ByteArrayOutputStream(); | |
int result = bis.read(); | |
while(result != -1) { | |
buf.write((byte) result); | |
result = bis.read(); | |
} | |
return buf.toString(charset); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment