All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.frameworkset.util.encoder.Charsets Maven / Gradle / Ivy

Go to download

bboss is a j2ee framework include aop/ioc,mvc,persistent,taglib,rpc,event ,bean-xml serializable and so on.http://www.bbossgroups.com

There is a newer version: 6.2.7
Show newest version
/**
 * 
 */
package org.frameworkset.util.encoder;

import java.nio.charset.Charset;

/**
 * @author yinbp
 *
 * @Date:2016-11-18 12:13:56
 */
public class Charsets {

	 //
    // This class should only contain Charset instances for required encodings. This guarantees that it will load
    // correctly and without delay on all Java platforms.
    //

    /**
     * Returns the given Charset or the default Charset if the given Charset is null.
     *
     * @param charset
     *            A charset or null.
     * @return the given Charset or the default Charset if the given Charset is null
     */
    public static Charset toCharset(final Charset charset) {
        return charset == null ? Charset.defaultCharset() : charset;
    }

    /**
     * Returns a Charset for the named charset. If the name is null, return the default Charset.
     *
     * @param charset
     *            The name of the requested charset, may be null.
     * @return a Charset for the named charset
     * @throws java.nio.charset.UnsupportedCharsetException
     *             If the named charset is unavailable
     */
    public static Charset toCharset(final String charset) {
        return charset == null ? Charset.defaultCharset() : Charset.forName(charset);
    }

    /**
     * CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
     * 

* Every implementation of the Java platform is required to support this character encoding. * * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated public static final Charset ISO_8859_1 = Charset.forName(CharEncoding.ISO_8859_1); /** * Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set. *

* Every implementation of the Java platform is required to support this character encoding. * * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated public static final Charset US_ASCII = Charset.forName(CharEncoding.US_ASCII); /** * Sixteen-bit Unicode Transformation Format, The byte order specified by a mandatory initial byte-order mark * (either order accepted on input, big-endian used on output) *

* Every implementation of the Java platform is required to support this character encoding. * * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated public static final Charset UTF_16 = Charset.forName(CharEncoding.UTF_16); /** * Sixteen-bit Unicode Transformation Format, big-endian byte order. *

* Every implementation of the Java platform is required to support this character encoding. * * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated public static final Charset UTF_16BE = Charset.forName(CharEncoding.UTF_16BE); /** * Sixteen-bit Unicode Transformation Format, little-endian byte order. *

* Every implementation of the Java platform is required to support this character encoding. * * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated public static final Charset UTF_16LE = Charset.forName(CharEncoding.UTF_16LE); /** * Eight-bit Unicode Transformation Format. *

* Every implementation of the Java platform is required to support this character encoding. * * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated public static final Charset UTF_8 = Charset.forName(CharEncoding.UTF_8); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy