Package java.nio.charset

Examples of java.nio.charset.Charset


        String clientEncoding = props.getProperty("client_encoding", "UTF-8");
        props.setProperty("client_encoding", clientEncoding);
        props.setProperty("default_transaction_isolation", "read committed");
        props.setProperty("DateStyle", "ISO");
        props.setProperty("TimeZone", Calendar.getInstance().getTimeZone().getDisplayName());
        Charset cs = PGCharsetConverter.getCharset(clientEncoding);
        if (cs != null) {
          this.encoding = cs;
        }
        this.odbcProxy.initialize(props);
        return message;
View Full Code Here


      terminate(e);
    }
  }
 
  public void setEncoding(String value) {
    Charset cs = PGCharsetConverter.getCharset(value);
    if (cs != null) {
      this.encoding = cs;
    }
  }
View Full Code Here

        super(factory);
    }
   
    @Override
    public Charset getCharset() {
      Charset cs = super.getCharset();
      if (cs != null) {
        return cs;
      }
      String enc = null;
      try {
View Full Code Here

    } catch (IOException e) {
      SQLException ex = new SQLException(e.getMessage());
      ex.initCause(e);
      throw ex;
    }
    Charset cs = getCharset();
    if (cs == null) {
      cs = Streamable.CHARSET;
    }
    return new InputStreamReader(getBinaryStream(), cs.newDecoder());
    }
View Full Code Here

          return type.encoding;
        }
        xml = type.reference;
      }
      if (xml instanceof SQLXMLImpl) {
        Charset cs = ((SQLXMLImpl)xml).getCharset();
        if (cs != null) {
          return cs.displayName();
        }
      }
      return getEncoding(xml.getBinaryStream());
    } catch (SQLException e) {
      return null;
View Full Code Here

    InputStream is = json.getBinaryStream();
    PushbackInputStream pStream = new PushbackInputStream(is, 4);
    byte[] encoding = new byte[3];
    int read = pStream.read(encoding);
    pStream.unread(encoding, 0, read);
    Charset charset = UTF_8;
    if (read > 2) {
      if (encoding[0] == 0) {
        if (encoding[1] == 0) {
          charset = UTF_32BE;
        } else {
View Full Code Here

    GetMethod get = new GetMethod(url);
    //get.setRequestHeader("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; zh-cn) Opera 8.52");
        try {
          http_client.executeMethod(get);
          if(get.getStatusCode()==HttpServletResponse.SC_OK){
            Charset cs = null;
            Header header_cs = getResponseHeader(get,"Content-Type");
            if(header_cs==null){
              cs = Charset.forName(get.getResponseCharSet());
            }
            else{
View Full Code Here

    public static String readStream(InputStream is, String charsetName) throws IOException {

        //
        // use system's default encoding if the passed encoding is unsupported
        //
        Charset charset = Charset.forName(System.getProperty("file.encoding"));
        if (Charset.isSupported(charsetName)) {
            charset = Charset.forName(charsetName);
        }

        StringBuffer out = new StringBuffer();
View Full Code Here

     
      /*
      if (info != null && info.fBOM == IContentDescription.BOM_UTF_16LE && CHARSET_UTF_16.equals(encoding))
        encoding= CHARSET_UTF_16LE;*/

      Charset charset;
      try {
        charset= Charset.forName(encoding);
      } catch (UnsupportedCharsetException ex) {
        String message= "Unsupported encoding '" + encoding + "'.";
        IStatus s= new Status(IStatus.ERROR, Plugin.PLUGIN_ID, IStatus.OK, message, ex);
        throw new CoreException(s);
      } catch (IllegalCharsetNameException ex) {
        String message= "Unsupported encoding '" + encoding + "'.";
        IStatus s= new Status(IStatus.ERROR, Plugin.PLUGIN_ID, IStatus.OK, message, ex);
        throw new CoreException(s);
      }

      CharsetEncoder encoder= charset.newEncoder();
      encoder.onMalformedInput(CodingErrorAction.REPLACE);
      encoder.onUnmappableCharacter(CodingErrorAction.REPORT);

      InputStream stream;

View Full Code Here

       
        return TimestampWithTimezone.createTimestamp(value, context.getServerTimeZone(), cal);
    }
   
    public static Clob toChars(BlobType value, String encoding) {
      Charset cs = getCharset(encoding);
    BlobInputStreamFactory bisf = new BlobInputStreamFactory(value.getReference());
      ClobImpl clob = new ClobImpl(bisf, -1);
      clob.setCharset(cs);
      return new ClobType(clob);
    }
View Full Code Here

TOP

Related Classes of java.nio.charset.Charset

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.