Code cleanup / Hide internal constants from a user
This commit is contained in:
parent
6cdd9ac711
commit
c98ab997c5
@ -16,6 +16,7 @@
|
|||||||
package org.jboss.netty.handler.codec.redis;
|
package org.jboss.netty.handler.codec.redis;
|
||||||
|
|
||||||
import org.jboss.netty.buffer.ChannelBuffer;
|
import org.jboss.netty.buffer.ChannelBuffer;
|
||||||
|
import org.jboss.netty.util.CharsetUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -23,11 +24,11 @@ import java.io.IOException;
|
|||||||
* Command serialization.
|
* Command serialization.
|
||||||
*/
|
*/
|
||||||
public class Command {
|
public class Command {
|
||||||
public static final byte[] ARGS_PREFIX = "*".getBytes();
|
static final byte[] ARGS_PREFIX = "*".getBytes();
|
||||||
public static final byte[] CRLF = "\r\n".getBytes();
|
static final byte[] CRLF = "\r\n".getBytes();
|
||||||
public static final byte[] BYTES_PREFIX = "$".getBytes();
|
static final byte[] BYTES_PREFIX = "$".getBytes();
|
||||||
public static final byte[] EMPTY_BYTES = new byte[0];
|
static final byte[] EMPTY_BYTES = new byte[0];
|
||||||
public static final byte[] NEG_ONE_AND_CRLF = convertWithCRLF(-1);
|
static final byte[] NEG_ONE_AND_CRLF = convertWithCRLF(-1);
|
||||||
|
|
||||||
private byte[][] arguments;
|
private byte[][] arguments;
|
||||||
private Object[] objects;
|
private Object[] objects;
|
||||||
@ -68,7 +69,7 @@ public class Command {
|
|||||||
} else if (object instanceof byte[]) {
|
} else if (object instanceof byte[]) {
|
||||||
arguments[i] = (byte[]) object;
|
arguments[i] = (byte[]) object;
|
||||||
} else {
|
} else {
|
||||||
arguments[i] = object.toString().getBytes("UTF-8");
|
arguments[i] = object.toString().getBytes(CharsetUtil.UTF_8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeDirect(os, arguments);
|
writeDirect(os, arguments);
|
||||||
|
@ -30,9 +30,6 @@ import org.jboss.netty.channel.SimpleChannelDownstreamHandler;
|
|||||||
@Sharable
|
@Sharable
|
||||||
public class RedisEncoder extends SimpleChannelDownstreamHandler {
|
public class RedisEncoder extends SimpleChannelDownstreamHandler {
|
||||||
|
|
||||||
public RedisEncoder() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
|
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
|
||||||
Object o = e.getMessage();
|
Object o = e.getMessage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user