Examples of EncodingStreamReader


Examples of com.substanceofcode.utils.EncodingStreamReader

    throws IOException, CauseMemoryException, CauseException, Exception {
        // Prepare buffer for input data
        StringBuffer inputBuffer = new StringBuffer();
       
    EncodingUtil encUtl = new EncodingUtil(is);
    EncodingStreamReader esr = encUtl.getEncodingStreamReader();

        try {
      // Read all data to buffer.  Use 100 char increments to save on
      // memory.
      inputBuffer = esr.readFile(100);
        } catch (IOException ex) {
      CauseException cex = new CauseException(
          "Error while parsing line by feed " + m_url, ex);
      throw cex;
        }
        String text;
    if (esr.isUtfDoc()) {
      final String fileEncoding = esr.getFileEncoding();
      if (esr.isUtf16Doc()) {
        encUtl.getEncoding(fileEncoding, "UTF-16");
      } else {
        encUtl.getEncoding(fileEncoding, "UTF-8");
      }
      final String docEncoding = encUtl.getDocEncoding();
View Full Code Here

Examples of com.substanceofcode.utils.EncodingStreamReader

      if (is == null) {
        throw new IOException("Unable to read file " +
                    "/"+Common.DATA_FOLDER+"/" + Common.LANGUAGE_FILE);
      }
      EncodingUtil encUtl = new EncodingUtil(is);
      EncodingStreamReader esr = encUtl.getEncodingStreamReader();
      StringBuffer inputBuffer;
      try {
        inputBuffer = esr.readFile(Common.LANGUAGE_FILE_LEN);
      } catch (IOException ex) {
        CauseException cex = new CauseException(
            "Error while reading file.", ex);
        throw cex;
      } finally {
        if (is != null) {
          try {
            is.close();
          } catch (Exception e) {
          }
        }
      }
      String text;
      /* If not UTF-8, treat it as one since we use XSL to create UTF-8.
         I couldn't create a file with BOM, so this is the next best
         thing.  */
      final String fileEncoding = esr.getFileEncoding();
      if (!esr.isUtfDoc()) {
        esr.setUtfDoc(true);
        encUtl.getEncoding(fileEncoding, "UTF-8");
      }
      if (esr.isUtfDoc()) {
        if (esr.isUtf16Doc()) {
          encUtl.getEncoding(fileEncoding, "UTF-16");
        } else {
          encUtl.getEncoding(fileEncoding, "UTF-8");
        }
        final String docEncoding = encUtl.getDocEncoding();
View Full Code Here

Examples of com.substanceofcode.utils.EncodingStreamReader

      if (is == null) {
        throw new IOException("Unable to read file " +
                    "/"+Common.DATA_FOLDER+"/" + Common.LANGUAGE_FILE);
      }
      EncodingUtil encUtl = new EncodingUtil(is);
      EncodingStreamReader esr = encUtl.getEncodingStreamReader();
      StringBuffer inputBuffer;
      try {
        inputBuffer = esr.readFile(Common.LANGUAGE_FILE_LEN);
      } catch (IOException ex) {
        CauseException cex = new CauseException(
            "Error while reading file.", ex);
        throw cex;
      } finally {
        if (is != null) {
          try {
            is.close();
          } catch (Exception e) {
          }
        }
      }
      String text;
      /* If not UTF-8, treat it as one since we use XSL to create UTF-8.
         I couldn't create a file with BOM, so this is the next best
         thing.  */
      final String fileEncoding = esr.getFileEncoding();
      if (!esr.isUtfDoc()) {
        esr.setUtfDoc(true);
        encUtl.getEncoding(fileEncoding, "UTF-8");
      }
      if (esr.isUtfDoc()) {
        if (esr.isUtf16Doc()) {
          encUtl.getEncoding(fileEncoding, "UTF-16");
        } else {
          encUtl.getEncoding(fileEncoding, "UTF-8");
        }
        final String docEncoding = encUtl.getDocEncoding();
View Full Code Here

Examples of com.substanceofcode.utils.EncodingStreamReader

    throws IOException, CauseMemoryException, CauseException, Exception {
        // Prepare buffer for input data
        StringBuffer inputBuffer = new StringBuffer();
       
    EncodingUtil encUtl = new EncodingUtil(is);
    EncodingStreamReader esr = encUtl.getEncodingStreamReader();

        try {
      // Read all data to buffer.  Use 100 char increments to save on
      // memory.
      inputBuffer = esr.readFile(100);
        } catch (IOException ex) {
      CauseException cex = new CauseException(
          "Error while parsing line by feed " + m_url, ex);
      throw cex;
        }
        String text;
    if (esr.isUtfDoc()) {
      final String fileEncoding = esr.getFileEncoding();
      if (esr.isUtf16Doc()) {
        encUtl.getEncoding(fileEncoding, "UTF-16");
      } else {
        encUtl.getEncoding(fileEncoding, "UTF-8");
      }
      final String docEncoding = encUtl.getDocEncoding();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.