Package fi.celia.convert.chars

Examples of fi.celia.convert.chars.CharConvertRows


      IOException,
      NullPointerException,
      Exception
  {
 
    CharConvertRows convertchars = null;
   
    // JAsciiMath jAsciiMath = null;
    try {
     
      CharConvertRows m_changeChars;
      logger.info("executeConversion methodi alkaa" );
      bExecuteAndRenameOK = false;
      executeResult = 0;
      sbML4 = new StringBuffer();
     
      m_strKorjattuDtBookTiedostoNimi = "";

      // parametritaksituksia
      if (outputFileNameValue == null)
        throw new NullPointerException("ml4FileNameValue == null");
      if (strWriteCharacterSet == null)
        throw new NullPointerException("strWriteCharacterSet == null");
      if (strWriteCharacterSet == null)
        throw new NullPointerException("strWriteCharacterSet == null");
 
      //sbMessage = new StringBuffer ();
      sbML4 =  new StringBuffer ();

      // osa flageista tulee gui-ohjelmasta, osa toisen ohjelman asettama
      logger.info("luettaan/asetetaan flageja")
           
      m_LastExec_bDtbookContainsMixedCharsets = bDtbookContainsMixedCharsets;

      String exec_dbbookFileNameValue = dbtbookFileNameValue;
           
      //jTextAreaLabel.setText(cnstML4Text);
      //jML4TextArea.setText("");
      //jML4ScrollPane.setViewportView(getJML4TextArea());
      bExecuteAndRenameOK = false;
      executeResult = 0;
      String line;
     
      //sbMessage = new StringBuffer ();
      //sbMessage.append("Muunnos käynnistetty:\n");
      //sbMessage.append("DtBook-asiakirja: " + dbbookFileNameValue +"\n");
      //sbMessage.append("ML4-asiakirja: " +ml4FileNameValue +"\n");
     
      /*
      if (bDtbookContainsMixedCharsets)
       {
        sbMessage.append("Suoritetaan ensin merkistän muunnos siltä varalta,\n"
             + "dtbook-asiakirja sisältää merkkejä eri merkistäistä (utf-8:sta sekä iso-8859-1:stä\n");        
       }
      jML4TextArea.setText(sbMessage.toString());
      */

      //Graphics g = jML4TextArea.getGraphics();
      //jML4TextArea.addNotify();
      //Thread.sleep(1000);

      /* .batin ajo:
       Process p = Runtime.getRuntime().exec
            ("dtbook2ml4.bat " + exec_dbbookFileNameValue + " " + outputFileName);
         BufferedReader input = new BufferedReader
              (new InputStreamReader(p.getInputStream()));
         while ((line = input.readLine()) != null) {
            //System.out.println(line);
            sb.append(line +"\n");
         }
         input.close();
         executeResult = p.exitValue();        
         */
            
         if (bDtbookContainsMixedCharsets) // jos gui-käyttäjä asettanut, nähtyään vast. virheilmoituksen paneelissa
         {
          logger.info("muunnetaan dtbook, jossa sekamerkkistäja utf-8:ksi");
      String modifiedContent;
            modifiedContent = 
            DecoderCharacterSet.readMixed88591AndUTF8FileConvertIntoUTF8(exec_dbbookFileNameValue);
            exec_dbbookFileNameValue = exec_dbbookFileNameValue +"_m";
            DecoderCharacterSet.writeToFileByUsingToCharacterSet(
                DecoderCharacterSet.UTF_8, modifiedContent,
                exec_dbbookFileNameValue);
         }
         else
         {
           if (!strReadCharacterSetOfInputFile.equals(cnstUTF8))
           {
              String modifiedContent;
              modifiedContent = 
              DecoderCharacterSet.readMixed88591AndUTF8FileConvertIntoUTF8(exec_dbbookFileNameValue);
              exec_dbbookFileNameValue = exec_dbbookFileNameValue +"_m";
              DecoderCharacterSet.writeToFileByUsingToCharacterSet(
                  DecoderCharacterSet.UTF_8, modifiedContent,
                  exec_dbbookFileNameValue);
           }           
         }
                 
         // read input file content:
         File fileInput = new File(exec_dbbookFileNameValue);
         FileInputStream is = new FileInputStream(fileInput);
         InputStreamReader isr = new InputStreamReader (is, strReadCharacterSetOfInputFile);

         BufferedReader input = new BufferedReader(isr);
         StringBuffer sb = new StringBuffer ();
         while ((line = input.readLine()) != null)
         {
           //System.out.println(line);
           sb.append(line +"\n");
         }
         input.close();
        
        String strInputData = sb.toString();
       
       CharConvertRows.setLogger(logger);
       boolean bLuePropertiesTiedostosta = true;
       boolean bHtmlArvotJavaMerkkijonoiksi = true;
       convertchars = new CharConvertRows (
           bLuePropertiesTiedostosta,
           bHtmlArvotJavaMerkkijonoiksi,
           m_giveMessage);

   
View Full Code Here

TOP

Related Classes of fi.celia.convert.chars.CharConvertRows

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.