Add @Override annotations

This commit is contained in:
norman 2012-03-12 07:32:23 +01:00
parent 05883f5523
commit 4cb3bf2c4a
8 changed files with 16 additions and 9 deletions

View File

@ -27,6 +27,7 @@ public class BulkReply extends Reply {
this.bytes = bytes; this.bytes = bytes;
} }
@Override
public void write(ChannelBuffer os) throws IOException { public void write(ChannelBuffer os) throws IOException {
os.writeByte(MARKER); os.writeByte(MARKER);
if (bytes == null) { if (bytes == null) {

View File

@ -21,10 +21,6 @@ import java.io.IOException;
/** /**
* Command serialization. * Command serialization.
* User: sam
* Date: 7/27/11
* Time: 3:04 PM
* To change this template use File | Settings | File Templates.
*/ */
public class Command { public class Command {
public static final byte[] ARGS_PREFIX = "*".getBytes(); public static final byte[] ARGS_PREFIX = "*".getBytes();

View File

@ -28,6 +28,7 @@ public class ErrorReply extends Reply {
this.error = error; this.error = error;
} }
@Override
public void write(ChannelBuffer os) throws IOException { public void write(ChannelBuffer os) throws IOException {
os.writeByte(MARKER); os.writeByte(MARKER);
os.writeBytes(ERR); os.writeBytes(ERR);

View File

@ -27,6 +27,7 @@ public class IntegerReply extends Reply {
this.integer = integer; this.integer = integer;
} }
@Override
public void write(ChannelBuffer os) throws IOException { public void write(ChannelBuffer os) throws IOException {
os.writeByte(MARKER); os.writeByte(MARKER);
os.writeBytes(Command.numAndCRLF(integer)); os.writeBytes(Command.numAndCRLF(integer));

View File

@ -30,6 +30,10 @@ public class MultiBulkReply extends Reply {
public MultiBulkReply() { public MultiBulkReply() {
} }
public MultiBulkReply(Object... values) {
this.byteArrays = values;
}
public void read(RedisDecoder rd, ChannelBuffer is) throws IOException { public void read(RedisDecoder rd, ChannelBuffer is) throws IOException {
// If we attempted to read the size before, skip the '*' and reread it // If we attempted to read the size before, skip the '*' and reread it
if (size == -1) { if (size == -1) {
@ -62,10 +66,7 @@ public class MultiBulkReply extends Reply {
} }
} }
public MultiBulkReply(Object... values) { @Override
this.byteArrays = values;
}
public void write(ChannelBuffer os) throws IOException { public void write(ChannelBuffer os) throws IOException {
os.writeByte(MARKER); os.writeByte(MARKER);
if (byteArrays == null) { if (byteArrays == null) {

View File

@ -28,6 +28,11 @@ import org.jboss.netty.channel.ChannelHandler.Sharable;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
/**
* {@link SimpleChannelDownstreamHandler} which encodes {@link Command}'s to {@link ChannelBuffer}'s
*
*
*/
@Sharable @Sharable
public class RedisEncoder extends SimpleChannelDownstreamHandler { public class RedisEncoder extends SimpleChannelDownstreamHandler {

View File

@ -25,6 +25,7 @@ public abstract class Reply {
public abstract void write(ChannelBuffer os) throws IOException; public abstract void write(ChannelBuffer os) throws IOException;
@Override
public String toString() { public String toString() {
ChannelBuffer channelBuffer = ChannelBuffers.dynamicBuffer(); ChannelBuffer channelBuffer = ChannelBuffers.dynamicBuffer();
try { try {

View File

@ -27,6 +27,7 @@ public class StatusReply extends Reply {
this.status = status; this.status = status;
} }
@Override
public void write(ChannelBuffer os) throws IOException { public void write(ChannelBuffer os) throws IOException {
os.writeByte(MARKER); os.writeByte(MARKER);
os.writeBytes(status); os.writeBytes(status);