There are a few options here. One thing you can do is get the integer value, then cast/print that:
(char) intFileContents.get(pos).intValue(); // Do something with this
Probably a better option would be to convert the int values you read in immediately, like this:
List<Character> charFileContents = new ArrayList<Character>(8192);
while ((fileBuffer = stream.read())!= -1) {
charFileContents.add((char) fileBuffer); // <-- Do the cast before storing the value
System.out.print(fileBuffer);
}
Then, when you go to print the character, it is already the proper type. Be warned that this only works for one specific encoding (don't remember which), so if you want another encoding you'll have to use a InputStreamReader
instead of a plain InputStream