diff --git a/src/main/java/io/lettuce/core/codec/Utf8StringCodec.java b/src/main/java/io/lettuce/core/codec/Utf8StringCodec.java deleted file mode 100644 index f00e0d4beb..0000000000 --- a/src/main/java/io/lettuce/core/codec/Utf8StringCodec.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.lettuce.core.codec; - -import java.nio.charset.StandardCharsets; - -/** - * A {@link RedisCodec} that handles UTF-8 encoded keys and values. - * - * @author Will Glozer - * @author Mark Paluch - * @see StringCodec - * @see StandardCharsets#UTF_8 - * @deprecated since 5.2, use {@link StringCodec#UTF8} instead. - */ -@Deprecated -public class Utf8StringCodec extends StringCodec implements RedisCodec { - - /** - * Initialize a new instance that encodes and decodes strings using the UTF-8 charset; - */ - public Utf8StringCodec() { - super(StandardCharsets.UTF_8); - } - -} diff --git a/src/test/java/io/lettuce/core/Utf8StringCodecIntegrationTests.java b/src/test/java/io/lettuce/core/Utf8StringCodecIntegrationTests.java deleted file mode 100644 index a75940e5a8..0000000000 --- a/src/test/java/io/lettuce/core/Utf8StringCodecIntegrationTests.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011-Present, Redis Ltd. and Contributors - * All rights reserved. - * - * Licensed under the MIT License. - * - * This file contains contributions from third-party contributors - * licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.lettuce.core; - -import static io.lettuce.TestTags.INTEGRATION_TEST; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Arrays; - -import javax.inject.Inject; - -import org.junit.jupiter.api.Tag; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -import io.lettuce.core.api.StatefulRedisConnection; -import io.lettuce.core.api.sync.RedisCommands; -import io.lettuce.test.LettuceExtension; - -/** - * @author Will Glozer - * @author Mark Paluch - */ -@Tag(INTEGRATION_TEST) -@ExtendWith(LettuceExtension.class) -class Utf8StringCodecIntegrationTests extends TestSupport { - - @Test - @Inject - void decodeHugeBuffer(StatefulRedisConnection connection) { - - RedisCommands redis = connection.sync(); - - char[] huge = new char[8192]; - Arrays.fill(huge, 'A'); - String value = new String(huge); - redis.set(key, value); - assertThat(redis.get(key)).isEqualTo(value); - } - -} diff --git a/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp3UnitTests.java b/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp3UnitTests.java index 443ec3b75d..e7f9e06a46 100644 --- a/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp3UnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp3UnitTests.java @@ -41,7 +41,6 @@ import io.lettuce.core.RedisException; import io.lettuce.core.codec.RedisCodec; import io.lettuce.core.codec.StringCodec; -import io.lettuce.core.codec.Utf8StringCodec; import io.lettuce.core.output.*; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; diff --git a/src/test/jmh/io/lettuce/core/codec/Utf8StringCodecBenchmark.java b/src/test/jmh/io/lettuce/core/codec/Utf8StringCodecBenchmark.java deleted file mode 100644 index a13779f82c..0000000000 --- a/src/test/jmh/io/lettuce/core/codec/Utf8StringCodecBenchmark.java +++ /dev/null @@ -1,45 +0,0 @@ -package io.lettuce.core.codec; - -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; - -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.infra.Blackhole; - -/** - * Benchmark for {@link Utf8StringCodec}. - * - * @author Mark Paluch - */ -public class Utf8StringCodecBenchmark { - - @Benchmark - public void encodeUnpooled(Input input) { - input.blackhole.consume(input.codec.encodeKey(input.teststring)); - } - - @Benchmark - public void decodeUnpooled(Input input) { - input.input.rewind(); - input.blackhole.consume(input.codec.decodeKey(input.input)); - } - - @State(Scope.Thread) - public static class Input { - - Blackhole blackhole; - Utf8StringCodec codec = new Utf8StringCodec(); - - String teststring = "hello üäü~∑†®†ª€∂‚¶¢ Wørld"; - ByteBuffer input = ByteBuffer.wrap(teststring.getBytes(StandardCharsets.UTF_8)); - - @Setup - public void setup(Blackhole bh) { - blackhole = bh; - input.flip(); - } - } -} diff --git a/src/test/jmh/io/lettuce/core/protocol/CommandBenchmark.java b/src/test/jmh/io/lettuce/core/protocol/CommandBenchmark.java index 5146d57685..126fa0b650 100644 --- a/src/test/jmh/io/lettuce/core/protocol/CommandBenchmark.java +++ b/src/test/jmh/io/lettuce/core/protocol/CommandBenchmark.java @@ -10,7 +10,6 @@ import io.lettuce.core.codec.ByteArrayCodec; import io.lettuce.core.codec.RedisCodec; import io.lettuce.core.codec.StringCodec; -import io.lettuce.core.codec.Utf8StringCodec; import io.lettuce.core.output.ValueOutput; /** @@ -26,7 +25,7 @@ public class CommandBenchmark { private static final ByteArrayCodec BYTE_ARRAY_CODEC = new ByteArrayCodec(); - private static final Utf8StringCodec OLD_STRING_CODEC = new Utf8StringCodec(); + private static final StringCodec OLD_STRING_CODEC = StringCodec.UTF8; private static final StringCodec NEW_STRING_CODEC = new StringCodec(StandardCharsets.UTF_8); private static final EmptyByteBuf DUMMY_BYTE_BUF = new EmptyByteBuf();