convert StandardCharsets to Kotlin (#43790)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43790

convert Java to Kotlin: `react/common/StandardCharsets.java`

Changelog:
[Internal] internal

Reviewed By: cortinico

Differential Revision: D55611308

fbshipit-source-id: 11af39f9bcff555c7d5b30e1836d73c09d278f72
This commit is contained in:
Alan Lee
2024-04-04 11:12:45 -07:00
committed by Facebook GitHub Bot
parent 9c00d6d332
commit c84f5cb5cd
2 changed files with 13 additions and 17 deletions
@@ -1760,6 +1760,7 @@ public final class com/facebook/react/common/SingleThreadAsserter {
}
public final class com/facebook/react/common/StandardCharsets {
public static final field INSTANCE Lcom/facebook/react/common/StandardCharsets;
public static final field UTF_16 Ljava/nio/charset/Charset;
public static final field UTF_16BE Ljava/nio/charset/Charset;
public static final field UTF_16LE Ljava/nio/charset/Charset;
@@ -5,32 +5,27 @@
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.common;
package com.facebook.react.common
import com.facebook.infer.annotation.Nullsafe;
import java.nio.charset.Charset;
import java.nio.charset.Charset
import kotlin.jvm.JvmField
/**
* Not all versions of Android SDK have this class in nio package. This is the reason to have it
* around.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
@Deprecated(
since = "Deprecated class since v0.73.0, please use java.nio.charset.StandardCharsets instead.",
forRemoval = true)
public final class StandardCharsets {
private StandardCharsets() {}
message =
"Deprecated class since v0.73.0, please use java.nio.charset.StandardCharsets instead.",
replaceWith = ReplaceWith("java.nio.charset.StandardCharsets"),
level = DeprecationLevel.ERROR)
public object StandardCharsets {
/** Eight-bit UCS Transformation Format */
public static final Charset UTF_8 = Charset.forName("UTF-8");
@JvmField public val UTF_8: Charset = Charset.forName("UTF-8")
/** Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark */
public static final Charset UTF_16 = Charset.forName("UTF-16");
@JvmField public val UTF_16: Charset = Charset.forName("UTF-16")
/** Sixteen-bit UCS Transformation Format, big-endian byte order */
public static final Charset UTF_16BE = Charset.forName("UTF-16BE");
@JvmField public val UTF_16BE: Charset = Charset.forName("UTF-16BE")
/** Sixteen-bit UCS Transformation Format, little-endian byte order */
public static final Charset UTF_16LE = Charset.forName("UTF-16LE");
@JvmField public val UTF_16LE: Charset = Charset.forName("UTF-16LE")
}