Decoder/Encoder throws IOException added

pull/243/head
Nikita 10 years ago
parent 6dcbf7c780
commit a347285e99

@ -15,10 +15,12 @@
*/ */
package org.redisson.client.protocol; package org.redisson.client.protocol;
import java.io.IOException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
public interface Decoder<R> { public interface Decoder<R> {
R decode(ByteBuf buf); R decode(ByteBuf buf) throws IOException;
} }

@ -15,8 +15,10 @@
*/ */
package org.redisson.client.protocol; package org.redisson.client.protocol;
import java.io.IOException;
public interface Encoder { public interface Encoder {
byte[] encode(int paramIndex, Object in); byte[] encode(int paramIndex, Object in) throws IOException;
} }

@ -15,7 +15,7 @@
*/ */
package org.redisson.client.protocol; package org.redisson.client.protocol;
import java.io.UnsupportedEncodingException; import java.io.IOException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
@ -41,12 +41,8 @@ public class StringCodec implements Codec {
public Encoder getValueEncoder() { public Encoder getValueEncoder() {
return new Encoder() { return new Encoder() {
@Override @Override
public byte[] encode(int paramIndex, Object in) { public byte[] encode(int paramIndex, Object in) throws IOException {
try {
return in.toString().getBytes("UTF-8"); return in.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
} }
}; };
} }

Loading…
Cancel
Save