I wanted to determine the type of file and its encoding (ASCII/Unicode) etc.
Found this link helpful: http://www.cyberciti.biz/faq/linuxunix-determine-file-type/
Further I also wanted to check the default character set supported by the Solaris system and used by the JVM at run-time. The primary reason behind checking this was the unusual behavior of the Java function RandomAccessFile.writeChars.
From the Javadocs, writeChars is always supposed to write characters as a two-byte value. But I observed that on one system it generated an ASCII file while on another it generated a Unicode file. Since I wanted to generate an ASCII file, I switched to using writeBytes.
But the mystery below is unsolved and is for a later date:
On Solaris box A (SunOS 5.10): RandomAccessFile.writeChars was writing ASCII characters
On Solaris box B (SunOS 5.9): RandomAccessFile.writeChars was writing UNICODE characters
I used the program
here as a reference for finding the default system character set.
Solaris Box A (using JDK 1.6 Update 11) provided the output:
Default Charset=ISO-8859-1
file.encoding=ISO8859-1
Default Charset=ISO-8859-1
Default Charset in Use=ISO8859_1
Solaris Box B (using JDK 1.6 Update 26) provided the output:
Default Charset=US-ASCII
file.encoding=ISO646-US
Default Charset=US-ASCII
Default Charset in Use=ASCII