Package java.nio.charset

Examples of java.nio.charset.Charset.displayName()


        Charset c = Charset.isSupported("UTF-8") ? Charset.forName("UTF-8") : Charset.defaultCharset();
        if (charset != null) {
            if (Charset.isSupported(charset)) {
                c = Charset.forName(charset);
            } else {
                LOGGER.error("Charset " + charset + " is not supported for layout, using " + c.displayName());
            }
        }
        Layout layout = (format.equalsIgnoreCase(RFC5424)) ?
            RFC5424Layout.createLayout(facility, id, ein, includeMDC, mdcId, includeNL, appName,  msgId,
                excludes, includes, required, charset, config) :
View Full Code Here


     * @param response request response
     * @return charset
     */
    protected static String getCharset(HttpResponse response) {
        Charset charset = getContentType(response).getCharset();
        return charset == null ? null : charset.displayName();
    }

    /**
     * Gets mime type of response
     *
 
View Full Code Here

      HTTPUtils.write400SignatureVerificationFailed(theResp.getOutputStream(), false);
      return;
    }

    Charset charset = decoder.getCharset();
    ourLog.debug("Message charset is {}", charset.displayName());

    RawReceivable rawMessage = new RawReceivable(decoder.getMessage());
    rawMessage.addMetadata(MessageMetadataKeys.REMOTE_HOST_ADDRESS.name(), theReq.getRemoteAddr());

    IResponseSendable<String> response;
View Full Code Here

      }
     
      String[] fields = PreParser.getFields(firstLine, "MSH-18(0)");
      String charset = stripNonLowAscii(fields[0]);
      Charset javaCs = CharSetUtil.convertHL7CharacterEncodingToCharSetvalue(charset);     
      log.debug("Detected MSH-18 value \"{}\" so using charset {}", charset, javaCs.displayName());     
      return javaCs;
    }
    catch(Exception e)
    {
      log.warn("Nonvalid charset - defaulting to US-ASCII", e);
View Full Code Here

        javaCs = CharSetUtil.convertHL7CharacterEncodingToCharSetvalue(charset);
      } catch (EncodingNotSupportedException e) {
        log.warn("Invalid or unsupported charset in MSH-18: \"{}\". Defaulting to US-ASCII", e);
        return Charset.forName("US-ASCII");
      }     
      log.debug("Detected MSH-18 value \"{}\" so using charset {}", charset, javaCs.displayName());     
      return javaCs;
    }
//    catch(Exception e)
//    {
//      log.warn("Nonvalid charset - defaulting to US-ASCII", e);
View Full Code Here

        try {
            String[] fields = PreParser.getFields(message, "MSH-18(0)");
            String hl7CharsetName = stripNonLowAscii(fields[0]);
            if (hl7CharsetName != null && hl7CharsetName.length() > 0)
                charset = HL7Charsets.getCharsetForHL7Encoding(hl7CharsetName);
            LOG.trace("Detected MSH-18 value \"{}\" so using charset {}", hl7CharsetName, charset.displayName());
        } catch (EncodingNotSupportedException e) {
            LOG.warn("Invalid or unsupported charset in MSH-18. Defaulting to {}", charset.displayName());
        } catch (HL7Exception e) {
            LOG.warn("Failed to parse MSH segment. Defaulting to {}", charset.displayName(), e);
        }
View Full Code Here

            String hl7CharsetName = stripNonLowAscii(fields[0]);
            if (hl7CharsetName != null && hl7CharsetName.length() > 0)
                charset = HL7Charsets.getCharsetForHL7Encoding(hl7CharsetName);
            LOG.trace("Detected MSH-18 value \"{}\" so using charset {}", hl7CharsetName, charset.displayName());
        } catch (EncodingNotSupportedException e) {
            LOG.warn("Invalid or unsupported charset in MSH-18. Defaulting to {}", charset.displayName());
        } catch (HL7Exception e) {
            LOG.warn("Failed to parse MSH segment. Defaulting to {}", charset.displayName(), e);
        }
        return charset;
    }
View Full Code Here

                charset = HL7Charsets.getCharsetForHL7Encoding(hl7CharsetName);
            LOG.trace("Detected MSH-18 value \"{}\" so using charset {}", hl7CharsetName, charset.displayName());
        } catch (EncodingNotSupportedException e) {
            LOG.warn("Invalid or unsupported charset in MSH-18. Defaulting to {}", charset.displayName());
        } catch (HL7Exception e) {
            LOG.warn("Failed to parse MSH segment. Defaulting to {}", charset.displayName(), e);
        }
        return charset;
    }

    static Charset checkCharset(byte[] message, Charset defaultCharset) {
View Full Code Here

        }
        if (charset == null) {
            charset = defaultCharset;
            if (charsetName != null) {
                StatusLogger.getLogger().error(
                        "Charset " + charsetName + " is not supported for layout, using " + charset.displayName());
            }
        }
        return charset;
    }
View Full Code Here

  {
//    File file = new File("utf-8.txt");
    File file = new File("windows-1252.txt");

    Charset guessedCharset = CharsetToolkit.guessEncoding(file, 4096);
    System.err.println("Charset found: " + guessedCharset.displayName());

    FileInputStream fis = new FileInputStream(file);
    InputStreamReader isr = new InputStreamReader(fis, guessedCharset);
    BufferedReader br = new BufferedReader(isr);
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.