Update of /cvsroot/tek/tek/server/protocol/tputils
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1507/server/protocol/tputils
Modified Files:
lib.java
Log Message:
Add Java 1.4 compatibility to ClientConstants (requires extra case).
Make the server's file I/O library respect the character set.
Index: lib.java
===================================================================
RCS file: /cvsroot/tek/tek/server/protocol/tputils/lib.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- lib.java 20 Dec 2001 01:48:15 -0000 1.3
+++ lib.java 24 Jul 2006 05:18:29 -0000 1.4
@@ -37,8 +37,13 @@
// otherwise try to read input from the file
{
try
- { File emailFile = new File(emailFileName);
- FileReader emailReader = new FileReader(emailFile);
+ {
+
+ Reader emailReader =
+ new BufferedReader(new InputStreamReader(new FileInputStream(emailFileName),
+ // bad dependence on client, could
+ // refactor to make it explicit that it's shared
+ tek.client.protocol.utils.ClientConstants.CHARSET));
while ((c = emailReader.read()) != -1)
{
ch = (char)c;
@@ -83,14 +88,22 @@
if (!(outputFile.exists()))
{
- FileWriter out = new FileWriter(outputFile);
- out.write(str, 0, i); // write all characters of str to the outputFile
- out.close();
+ Writer out =
+ new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename),
+ // bad dependence on client, could
+ // refactor to make it explicit that it's shared
+ tek.client.protocol.utils.ClientConstants.CHARSET));
+ out.write(str, 0, i); // write all characters of str to the outputFile
+ out.close();
}
else
{
//throw new BadFileNameException();
- FileWriter out = new FileWriter(filename, true);
+ Writer out =
+ new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename, true),
+ // bad dependence on client, could
+ // refactor to make it explicit that it's shared
+ tek.client.protocol.utils.ClientConstants.CHARSET));
out.write(str, 0, i); // write all characters of str to the outputFile
out.close();
}
|