Uses of Class
java.nio.charset.Charset
-
Packages that use Charset Package Description java.io Provides for system input and output through data streams, serialization and the file system.java.lang Provides classes that are fundamental to the design of the Java programming language.java.nio.charset Defines charsets, decoders, and encoders, for translating between bytes and Unicode characters.java.nio.charset.spi Service-provider classes for thejava.nio.charset
package.java.nio.file Defines interfaces and classes for the Java virtual machine to access files, file attributes, and file systems.java.util.zip Provides classes for reading and writing the standard ZIP and GZIP file formats.javax.tools Provides interfaces for tools which can be invoked from a program, for example, compilers. -
-
Uses of Charset in java.io
Constructors in java.io with parameters of type Charset Constructor and Description InputStreamReader(InputStream in, Charset cs)
Creates an InputStreamReader that uses the given charset.OutputStreamWriter(OutputStream out, Charset cs)
Creates an OutputStreamWriter that uses the given charset. -
Uses of Charset in java.lang
Methods in java.lang with parameters of type Charset Modifier and Type Method and Description byte[]
String. getBytes(Charset charset)
Encodes thisString
into a sequence of bytes using the given charset, storing the result into a new byte array.Constructors in java.lang with parameters of type Charset Constructor and Description String(byte[] bytes, Charset charset)
Constructs a newString
by decoding the specified array of bytes using the specified charset.String(byte[] bytes, int offset, int length, Charset charset)
Constructs a newString
by decoding the specified subarray of bytes using the specified charset. -
Uses of Charset in java.nio.charset
Fields in java.nio.charset declared as Charset Modifier and Type Field and Description static Charset
StandardCharsets. ISO_8859_1
ISO Latin Alphabet No.static Charset
StandardCharsets. US_ASCII
Seven-bit ASCII, a.k.a.static Charset
StandardCharsets. UTF_16
Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order markstatic Charset
StandardCharsets. UTF_16BE
Sixteen-bit UCS Transformation Format, big-endian byte orderstatic Charset
StandardCharsets. UTF_16LE
Sixteen-bit UCS Transformation Format, little-endian byte orderstatic Charset
StandardCharsets. UTF_8
Eight-bit UCS Transformation FormatMethods in java.nio.charset that return Charset Modifier and Type Method and Description Charset
CharsetEncoder. charset()
Returns the charset that created this encoder.Charset
CharsetDecoder. charset()
Returns the charset that created this decoder.static Charset
Charset. defaultCharset()
Returns the default charset of this Java virtual machine.Charset
CharsetDecoder. detectedCharset()
Retrieves the charset that was detected by this decoder (optional operation).static Charset
Charset. forName(String charsetName)
Returns a charset object for the named charset.Methods in java.nio.charset that return types with arguments of type Charset Modifier and Type Method and Description static SortedMap<String,Charset>
Charset. availableCharsets()
Constructs a sorted map from canonical charset names to charset objects.Methods in java.nio.charset with parameters of type Charset Modifier and Type Method and Description int
Charset. compareTo(Charset that)
Compares this charset to another.abstract boolean
Charset. contains(Charset cs)
Tells whether or not this charset contains the given charset.Constructors in java.nio.charset with parameters of type Charset Constructor and Description CharsetDecoder(Charset cs, float averageCharsPerByte, float maxCharsPerByte)
Initializes a new decoder.CharsetEncoder(Charset cs, float averageBytesPerChar, float maxBytesPerChar)
Initializes a new encoder.CharsetEncoder(Charset cs, float averageBytesPerChar, float maxBytesPerChar, byte[] replacement)
Initializes a new encoder. -
Uses of Charset in java.nio.charset.spi
Methods in java.nio.charset.spi that return Charset Modifier and Type Method and Description abstract Charset
CharsetProvider. charsetForName(String charsetName)
Retrieves a charset for the given charset name.Methods in java.nio.charset.spi that return types with arguments of type Charset Modifier and Type Method and Description abstract Iterator<Charset>
CharsetProvider. charsets()
Creates an iterator that iterates over the charsets supported by this provider. -
Uses of Charset in java.nio.file
Methods in java.nio.file with parameters of type Charset Modifier and Type Method and Description static Stream<String>
Files. lines(Path path, Charset cs)
Read all lines from a file as aStream
.static BufferedReader
Files. newBufferedReader(Path path, Charset cs)
Opens a file for reading, returning aBufferedReader
that may be used to read text from the file in an efficient manner.static BufferedWriter
Files. newBufferedWriter(Path path, Charset cs, OpenOption... options)
Opens or creates a file for writing, returning aBufferedWriter
that may be used to write text to the file in an efficient manner.static List<String>
Files. readAllLines(Path path, Charset cs)
Read all lines from a file.static Path
Files. write(Path path, Iterable<? extends CharSequence> lines, Charset cs, OpenOption... options)
Write lines of text to a file. -
Uses of Charset in java.util.zip
Constructors in java.util.zip with parameters of type Charset Constructor and Description ZipFile(File file, Charset charset)
Opens a ZIP file for reading given the specified File object.ZipFile(File file, int mode, Charset charset)
Opens a newZipFile
to read from the specifiedFile
object in the specified mode.ZipFile(String name, Charset charset)
Opens a zip file for reading.ZipInputStream(InputStream in, Charset charset)
Creates a new ZIP input stream.ZipOutputStream(OutputStream out, Charset charset)
Creates a new ZIP output stream. -
Uses of Charset in javax.tools
Methods in javax.tools with parameters of type Charset Modifier and Type Method and Description StandardJavaFileManager
DocumentationTool. getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset)
Gets a new instance of the standard file manager implementation for this tool.StandardJavaFileManager
JavaCompiler. getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener, Locale locale, Charset charset)
Gets a new instance of the standard file manager implementation for this tool.
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.