当前位置: 首页>>代码示例>>Java>>正文


Java ThreadLocalCoders类代码示例

本文整理汇总了Java中sun.nio.cs.ThreadLocalCoders的典型用法代码示例。如果您正苦于以下问题:Java ThreadLocalCoders类的具体用法?Java ThreadLocalCoders怎么用?Java ThreadLocalCoders使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ThreadLocalCoders类属于sun.nio.cs包,在下文中一共展示了ThreadLocalCoders类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

import sun.nio.cs.ThreadLocalCoders; //导入依赖的package包/类
/**
 * Convenience method that decodes bytes in this charset into Unicode
 * characters.
 *
 * <p> An invocation of this method upon a charset <tt>cs</tt> returns the
 * same result as the expression
 *
 * <pre>
 *     cs.newDecoder()
 *       .onMalformedInput(CodingErrorAction.REPLACE)
 *       .onUnmappableCharacter(CodingErrorAction.REPLACE)
 *       .decode(bb); </pre>
 *
 * except that it is potentially more efficient because it can cache
 * decoders between successive invocations.
 *
 * <p> This method always replaces malformed-input and unmappable-character
 * sequences with this charset's default replacement byte array.  In order
 * to detect such sequences, use the {@link
 * CharsetDecoder#decode(java.nio.ByteBuffer)} method directly.  </p>
 *
 * @param  bb  The byte buffer to be decoded
 *
 * @return  A char buffer containing the decoded characters
 */
public final CharBuffer decode(ByteBuffer bb) {
    try {
        return ThreadLocalCoders.decoderFor(this)
            .onMalformedInput(CodingErrorAction.REPLACE)
            .onUnmappableCharacter(CodingErrorAction.REPLACE)
            .decode(bb);
    } catch (CharacterCodingException x) {
        throw new Error(x);         // Can't happen
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:Charset.java

示例2: encode

import sun.nio.cs.ThreadLocalCoders; //导入依赖的package包/类
/**
 * Convenience method that encodes Unicode characters into bytes in this
 * charset.
 *
 * <p> An invocation of this method upon a charset <tt>cs</tt> returns the
 * same result as the expression
 *
 * <pre>
 *     cs.newEncoder()
 *       .onMalformedInput(CodingErrorAction.REPLACE)
 *       .onUnmappableCharacter(CodingErrorAction.REPLACE)
 *       .encode(bb); </pre>
 *
 * except that it is potentially more efficient because it can cache
 * encoders between successive invocations.
 *
 * <p> This method always replaces malformed-input and unmappable-character
 * sequences with this charset's default replacement string.  In order to
 * detect such sequences, use the {@link
 * CharsetEncoder#encode(java.nio.CharBuffer)} method directly.  </p>
 *
 * @param  cb  The char buffer to be encoded
 *
 * @return  A byte buffer containing the encoded characters
 */
public final ByteBuffer encode(CharBuffer cb) {
    try {
        return ThreadLocalCoders.encoderFor(this)
            .onMalformedInput(CodingErrorAction.REPLACE)
            .onUnmappableCharacter(CodingErrorAction.REPLACE)
            .encode(cb);
    } catch (CharacterCodingException x) {
        throw new Error(x);         // Can't happen
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:Charset.java

示例3: decode

import sun.nio.cs.ThreadLocalCoders; //导入依赖的package包/类
/**
 * Convenience method that decodes bytes in this charset into Unicode
 * characters.
 *
 * <p> An invocation of this method upon a charset {@code cs} returns the
 * same result as the expression
 *
 * <pre>
 *     cs.newDecoder()
 *       .onMalformedInput(CodingErrorAction.REPLACE)
 *       .onUnmappableCharacter(CodingErrorAction.REPLACE)
 *       .decode(bb); </pre>
 *
 * except that it is potentially more efficient because it can cache
 * decoders between successive invocations.
 *
 * <p> This method always replaces malformed-input and unmappable-character
 * sequences with this charset's default replacement byte array.  In order
 * to detect such sequences, use the {@link
 * CharsetDecoder#decode(java.nio.ByteBuffer)} method directly.  </p>
 *
 * @param  bb  The byte buffer to be decoded
 *
 * @return  A char buffer containing the decoded characters
 */
public final CharBuffer decode(ByteBuffer bb) {
    try {
        return ThreadLocalCoders.decoderFor(this)
            .onMalformedInput(CodingErrorAction.REPLACE)
            .onUnmappableCharacter(CodingErrorAction.REPLACE)
            .decode(bb);
    } catch (CharacterCodingException x) {
        throw new Error(x);         // Can't happen
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:Charset.java

示例4: encode

import sun.nio.cs.ThreadLocalCoders; //导入依赖的package包/类
/**
 * Convenience method that encodes Unicode characters into bytes in this
 * charset.
 *
 * <p> An invocation of this method upon a charset {@code cs} returns the
 * same result as the expression
 *
 * <pre>
 *     cs.newEncoder()
 *       .onMalformedInput(CodingErrorAction.REPLACE)
 *       .onUnmappableCharacter(CodingErrorAction.REPLACE)
 *       .encode(bb); </pre>
 *
 * except that it is potentially more efficient because it can cache
 * encoders between successive invocations.
 *
 * <p> This method always replaces malformed-input and unmappable-character
 * sequences with this charset's default replacement string.  In order to
 * detect such sequences, use the {@link
 * CharsetEncoder#encode(java.nio.CharBuffer)} method directly.  </p>
 *
 * @param  cb  The char buffer to be encoded
 *
 * @return  A byte buffer containing the encoded characters
 */
public final ByteBuffer encode(CharBuffer cb) {
    try {
        return ThreadLocalCoders.encoderFor(this)
            .onMalformedInput(CodingErrorAction.REPLACE)
            .onUnmappableCharacter(CodingErrorAction.REPLACE)
            .encode(cb);
    } catch (CharacterCodingException x) {
        throw new Error(x);         // Can't happen
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:Charset.java

示例5: decode

import sun.nio.cs.ThreadLocalCoders; //导入依赖的package包/类
/**
    * Convenience method that decodes bytes in this charset into Unicode
    * characters.
    *
    * <p> An invocation of this method upon a charset <tt>cs</tt> returns the
    * same result as the expression
    *
    * <pre>
    *     cs.newDecoder()
    *       .onMalformedInput(CodingErrorAction.REPLACE)
    *       .onUnmappableCharacter(CodingErrorAction.REPLACE)
    *       .decode(bb); </pre>
    *
    * except that it is potentially more efficient because it can cache
    * decoders between successive invocations.
    *
    * <p> This method always replaces malformed-input and unmappable-character
    * sequences with this charset's default replacement byte array.  In order
    * to detect such sequences, use the {@link
    * CharsetDecoder#decode(java.nio.ByteBuffer)} method directly.  </p>
    *
    * @param  bb  The byte buffer to be decoded
    *
    * @return  A char buffer containing the decoded characters
    */
   public final CharBuffer decode(ByteBuffer bb) {
try {
    return ThreadLocalCoders.decoderFor(this)
	.onMalformedInput(CodingErrorAction.REPLACE)
	.onUnmappableCharacter(CodingErrorAction.REPLACE)
	.decode(bb);
} catch (CharacterCodingException x) {
    throw new Error(x);		// Can't happen
}
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:36,代码来源:Charset.java

示例6: encode

import sun.nio.cs.ThreadLocalCoders; //导入依赖的package包/类
/**
    * Convenience method that encodes Unicode characters into bytes in this
    * charset.
    *
    * <p> An invocation of this method upon a charset <tt>cs</tt> returns the
    * same result as the expression
    *
    * <pre>
    *     cs.newEncoder()
    *       .onMalformedInput(CodingErrorAction.REPLACE)
    *       .onUnmappableCharacter(CodingErrorAction.REPLACE)
    *       .encode(bb); </pre>
    *
    * except that it is potentially more efficient because it can cache
    * encoders between successive invocations.
    *
    * <p> This method always replaces malformed-input and unmappable-character
    * sequences with this charset's default replacement string.  In order to
    * detect such sequences, use the {@link
    * CharsetEncoder#encode(java.nio.CharBuffer)} method directly.  </p>
    *
    * @param  cb  The char buffer to be encoded
    *
    * @return  A byte buffer containing the encoded characters
    */
   public final ByteBuffer encode(CharBuffer cb) {
try {
    return ThreadLocalCoders.encoderFor(this)
	.onMalformedInput(CodingErrorAction.REPLACE)
	.onUnmappableCharacter(CodingErrorAction.REPLACE)
	.encode(cb);
} catch (CharacterCodingException x) {
    throw new Error(x);		// Can't happen
}
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:36,代码来源:Charset.java


注:本文中的sun.nio.cs.ThreadLocalCoders类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。