/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
/*
Currently javac and load() method in java.util.Properties
supports only Latin1 encoding input.
But in Asian platforms programmer or message translator
uses the editor which support othere than latin1 encoding
to specify their native language string.
So if programmer or message translator wants to use other than
they must convert the file to ASCII plus \udddd notation.
time constraints for JDK1.1)
This utility is for the purpose of that conversion.
NAME
native2ascii - convert native encoding file to ascii file
include \udddd Unicode notation
SYNOPSIS
native2ascii [options] [inputfile [outputfile]]
DESCRIPTION
If outputfile is not described standard output is used as
output file, and if inputfile is not also described
stardard input is used as input file.
Options
-reverse
convert ascii with \udddd notation to native encoding
-encoding encoding_name
Specify the encoding name which is used by conversion.
8859_[1 - 9], JIS, EUCJIS, SJIS is currently supported.
Default encoding is taken from System property "file.encoding".
*/
/**
* Main program of the native2ascii
*/
public class Main {
boolean reverse = false;
/**
* Run the converter
*/
boolean createOutputFile = false;
// Parse arguments
encodingString = argv[++i];
} else {
usage();
return false;
}
reverse = true;
} else {
if (v.size() > 1) {
usage();
return false;
}
}
}
if (encodingString == null)
try {
if (v.size() == 1)
if (v.size() == 2) {
createOutputFile = true;
}
if (createOutputFile) {
}
}
if (reverse){
}
}
} else {
//N2A
}
}
}
// Since we are done rename temporary file to desired output file
if (createOutputFile) {
if (outputFile.exists()) {
// Some win32 platforms can't handle atomic
// rename if source and target file paths are
// identical. To make things simple we just unconditionally
// delete the target file before calling renameTo()
outputFile.delete();
}
}
} catch(Exception e){
return false;
}
return true;
}
}
private void usage(){
}
else {
if (!f.canRead()){
}
try {
} catch (IOException e) {
}
}
encodingString)) :
return r;
}
else {
".TMP",
tempDir);
try {
} catch (IOException e){
}
}
return n2aOut;
}
else {
if (!f.canRead()){
}
try {
} catch (Exception e) {
}
}
return reader;
}
OutputStreamWriter w = null;
else {
".TMP",
tempDir);
try {
} catch (IOException e){
}
}
w = (encodingString != null) ?
new OutputStreamWriter(output);
return (w);
}
try {
} catch (UnsupportedCharsetException x) {
throw new Error(x);
}
}
return null;
}
}
try {
cs.newEncoder() :
null;
} catch (IllegalCharsetNameException e) {
throw new Error(e);
}
}
static {
try {
"sun.tools.native2ascii.resources.MsgNative2ascii");
} catch (MissingResourceException e) {
throw new Error("Missing message file.");
}
}
try {
} catch (MissingResourceException e) {
throw new Error("Error in message file format.");
}
}
}
/**
* Main program
*/
}
}