Examples of newDecoder()


Examples of com.aragost.javahg.Repository.newDecoder()

        // Make a copy
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ByteStreams.copy(stream, bos);
        stream.consumeAll();
        stream = new HgInputStream(new ByteArrayInputStream(bos.toByteArray()), repo.newDecoder());

        if (stream.find(BEGIN)) {
            result = Lists.newArrayList();
            while (!stream.isEof() && !stream.match(BEGIN_FALLBACK)) {
                result.add(repo.changeset(stream.textUpTo('\n')));
View Full Code Here

Examples of com.ibm.icu.charset.CharsetICU.newDecoder()

            (byte)0xcb, (byte)0x82
        };
       
        CharsetProviderICU cs = new CharsetProviderICU();
        CharsetICU charset = (CharsetICU)cs.charsetForName("scsu");
        CharsetDecoder decode = charset.newDecoder();
        CharsetEncoder encode = charset.newEncoder();
       
        //String[] codePoints = {"allFeatures", "german","russian","japanese"};
        byte[][] fromUnicode={allFeaturesSCSU,germanSCSU,russianSCSU,japaneseSCSU};
        char[][] toUnicode = {allFeaturesUTF16, germanUTF16,russianUTF16,japaneseUTF16};
View Full Code Here

Examples of fr.jayasoft.crypto.Crypto.newDecoder()

        if (key==null) {
            LOGGER.warn("creation of a " + cryptoAlgo + " decoder has failed");
            return null;
        }
        LOGGER.info("Decoder built from key in file: " + keyFile);
        return cr.newDecoder(key);
    }

    private static byte[] readKey(String dir, String keyFile) {
        File f = new File(dir, keyFile);
        BufferedReader r = null;
View Full Code Here

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

    }
    Charset cs = getCharset();
    if (cs == null) {
      cs = Streamable.CHARSET;
    }
    return new InputStreamReader(getBinaryStream(), cs.newDecoder());
    }

    public InputStream getBinaryStream() throws SQLException {
      try {
      return this.getStreamFactory().getInputStream();
View Full Code Here

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

    public CharsetDecoder getDecoder(String encodingName, boolean ignoreEncodingErrors) {
        Charset cs = (this.charset == null)
            ? Charset.forName(encodingName)
            : this.charset;
        CharsetDecoder decoder = cs.newDecoder();

        CodingErrorAction action;
        if (ignoreEncodingErrors)
            action = CodingErrorAction.REPLACE;
        else
View Full Code Here

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

     * @param buffer the given buffer to analyze.
     * @return the decoded string
     */
    protected String decode(final ByteBuffer buffer) {
        Charset charset = Charset.forName("UTF-8");
        CharsetDecoder charsetDecoder = charset.newDecoder();

        CharBuffer charBuffer = null;
        try {
            charBuffer = charsetDecoder.decode(buffer);
        } catch (CharacterCodingException e) {
View Full Code Here

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

  public static String toString(ByteBuffer buffer, String encoding) throws UnsupportedEncodingException {
    try {
      CharsetDecoder decoder = decoders.get(encoding);
      if (decoder == null) {
        Charset charset = Charset.forName(encoding);
        decoder = charset.newDecoder();
          decoders.put(encoding, decoder);
          encoders.put(encoding, charset.newEncoder());
      }
     
      return decoder.decode(buffer).toString();
View Full Code Here

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

        Charset charset = Charset.forName("UTF-8");
        buf.clear();
        buf.putString("hello", charset.newEncoder());
        buf.put((byte) 0);
        buf.flip();
        Assert.assertEquals("hello", buf.getString(charset.newDecoder()));

        buf.clear();
        buf.putString("hello", charset.newEncoder());
        buf.flip();
        Assert.assertEquals("hello", buf.getString(charset.newDecoder()));
View Full Code Here

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

        Assert.assertEquals("hello", buf.getString(charset.newDecoder()));

        buf.clear();
        buf.putString("hello", charset.newEncoder());
        buf.flip();
        Assert.assertEquals("hello", buf.getString(charset.newDecoder()));

        decoder = Charset.forName("ISO-8859-1").newDecoder();
        buf.clear();
        buf.put((byte) 'A');
        buf.put((byte) 'B');
View Full Code Here

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

  }
 
  public static ConnectionCostsWriter build(String filename) throws IOException {
    FileInputStream inputStream = new FileInputStream(filename);
    Charset cs = Charset.forName("US-ASCII");
    CharsetDecoder decoder = cs.newDecoder()
        .onMalformedInput(CodingErrorAction.REPORT)
        .onUnmappableCharacter(CodingErrorAction.REPORT);
    InputStreamReader streamReader = new InputStreamReader(inputStream, decoder);
    LineNumberReader lineReader = new LineNumberReader(streamReader);
   
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.