Rename SnappyFramedEncoder/Decoder to SnappyFrameEncoder/Decoder

Related issue: #2766

Motivation:

Forgot to rename them before the final release by mistake.

Modifications:

Rename the classes

Result:

Better naming
This commit is contained in:
Trustin Lee 2014-08-14 15:17:10 -07:00
parent 6a7fd374a2
commit 2af7a482d9
5 changed files with 16 additions and 15 deletions

View File

@ -15,7 +15,6 @@
*/
package io.netty.handler.codec.compression;
import static io.netty.handler.codec.compression.Snappy.validateChecksum;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandlerContext;
@ -24,6 +23,8 @@ import io.netty.handler.codec.ByteToMessageDecoder;
import java.util.Arrays;
import java.util.List;
import static io.netty.handler.codec.compression.Snappy.*;
/**
* Uncompresses a {@link ByteBuf} encoded with the Snappy framing format.
*
@ -32,10 +33,10 @@ import java.util.List;
* Note that by default, validation of the checksum header in each chunk is
* DISABLED for performance improvements. If performance is less of an issue,
* or if you would prefer the safety that checksum validation brings, please
* use the {@link #SnappyFramedDecoder(boolean)} constructor with the argument
* use the {@link #SnappyFrameDecoder(boolean)} constructor with the argument
* set to {@code true}.
*/
public class SnappyFramedDecoder extends ByteToMessageDecoder {
public class SnappyFrameDecoder extends ByteToMessageDecoder {
private enum ChunkType {
STREAM_IDENTIFIER,
@ -57,9 +58,9 @@ public class SnappyFramedDecoder extends ByteToMessageDecoder {
/**
* Creates a new snappy-framed decoder with validation of checksums
* turned OFF. To turn checksum validation on, please use the alternate
* {@link #SnappyFramedDecoder(boolean)} constructor.
* {@link #SnappyFrameDecoder(boolean)} constructor.
*/
public SnappyFramedDecoder() {
public SnappyFrameDecoder() {
this(false);
}
@ -72,7 +73,7 @@ public class SnappyFramedDecoder extends ByteToMessageDecoder {
* uncompressed data, and if the checksums do not match, a suitable
* {@link DecompressionException} will be thrown
*/
public SnappyFramedDecoder(boolean validateChecksums) {
public SnappyFrameDecoder(boolean validateChecksums) {
this.validateChecksums = validateChecksums;
}

View File

@ -27,7 +27,7 @@ import static io.netty.handler.codec.compression.Snappy.*;
*
* See http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
*/
public class SnappyFramedEncoder extends MessageToByteEncoder<ByteBuf> {
public class SnappyFrameEncoder extends MessageToByteEncoder<ByteBuf> {
/**
* The minimum amount that we'll consider actually attempting to compress.
* This value is preamble + the minimum length our Snappy service will

View File

@ -24,12 +24,12 @@ import org.junit.Test;
import static io.netty.util.ReferenceCountUtil.releaseLater;
import static org.junit.Assert.*;
public class SnappyFramedDecoderTest {
public class SnappyFrameDecoderTest {
private EmbeddedChannel channel;
@Before
public void initChannel() {
channel = new EmbeddedChannel(new SnappyFramedDecoder());
channel = new EmbeddedChannel(new SnappyFrameDecoder());
}
@Test(expected = DecompressionException.class)
@ -133,7 +133,7 @@ public class SnappyFramedDecoderTest {
@Test(expected = DecompressionException.class)
public void testInvalidChecksumThrowsException() throws Exception {
EmbeddedChannel channel = new EmbeddedChannel(new SnappyFramedDecoder(true));
EmbeddedChannel channel = new EmbeddedChannel(new SnappyFrameDecoder(true));
// checksum here is presented as 0
ByteBuf in = Unpooled.wrappedBuffer(new byte[] {
@ -146,7 +146,7 @@ public class SnappyFramedDecoderTest {
@Test
public void testInvalidChecksumDoesNotThrowException() throws Exception {
EmbeddedChannel channel = new EmbeddedChannel(new SnappyFramedDecoder(true));
EmbeddedChannel channel = new EmbeddedChannel(new SnappyFrameDecoder(true));
// checksum here is presented as a282986f (little endian)
ByteBuf in = Unpooled.wrappedBuffer(new byte[] {

View File

@ -25,12 +25,12 @@ import org.junit.Test;
import static io.netty.util.ReferenceCountUtil.*;
import static org.junit.Assert.*;
public class SnappyFramedEncoderTest {
public class SnappyFrameEncoderTest {
private EmbeddedChannel channel;
@Before
public void setUp() {
channel = new EmbeddedChannel(new SnappyFramedEncoder());
channel = new EmbeddedChannel(new SnappyFrameEncoder());
}
@Test

View File

@ -33,12 +33,12 @@ public class SnappyIntegrationTest extends IntegrationTest {
@Override
protected EmbeddedChannel createEncoderEmbeddedChannel() {
return new EmbeddedChannel(new SnappyFramedEncoder());
return new EmbeddedChannel(new SnappyFrameEncoder());
}
@Override
protected EmbeddedChannel createDecoderEmbeddedChannel() {
return new EmbeddedChannel(new SnappyFramedDecoder());
return new EmbeddedChannel(new SnappyFrameDecoder());
}
@Test