DecoderCharacterSet.CHARACTERSET writeCharacterSet =
DecoderCharacterSet.getCharacterSet(writeWithCharSet);
DecoderCharacterSet.CHARACTERSET readCharacterSet =
DecoderCharacterSet.getCharacterSet(readWithCharSet);
DecoderCharacterSet decoder = new DecoderCharacterSet(
readCharacterSet, writeCharacterSet);
String strTeos = decoder.readFromFileByUsingReadCharacterSet(dest);
if (strTeos == null)
{
String msg = "Tiedostosta " + dest +" ei saatu luettua merkkejä!";
logger.severe(msg);
virhe(msg);
}
int ind = strTeos.indexOf("S OSA");
while(ind != -1)
{
if ((ind-20) >= 0)
System.out.println(strTeos.substring((ind-20), (ind+"S OSA".length())));
else
System.out.println(strTeos.substring(ind, (ind+"S OSA".length())));
ind = strTeos.indexOf("S OSA", ind+1);
}
//String tmpFileName = dest +".tmp";
String tmpFileName = dest;
File tmpFile = new File(tmpFileName);
FileOutputStream bos = new FileOutputStream(tmpFile);
// Alkuun ensin merkistä:
String msg = "Kirjoitetaan muunnetut merkit tiedostoon: " + tmpFileName;
System.out.println(msg);
logger.info(msg);
if (bLisaaMerkisto)
bos.write(decoder.convertCharacterSetBytes(annaMerkisto(), CR));
// Sitten varsinainen julk. teostiedosto.
bos.write(decoder.convertCharacterSetBytes(strTeos, ""));
bos.close();
msg = "Kirjoitus loppu. Ok";
System.out.println(msg);
logger.info(msg);