Skip to content

Commit

Permalink
convert StandardCharsets to Kotlin (#43790)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #43790

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

Changelog:
[Internal] internal

Reviewed By: cortinico

Differential Revision: D55611308

fbshipit-source-id: 11af39f9bcff555c7d5b30e1836d73c09d278f72
  • Loading branch information
alanleedev authored and facebook-github-bot committed Apr 4, 2024
1 parent 9c00d6d commit c84f5cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
1 change: 1 addition & 0 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit c84f5cb

Please sign in to comment.