Reformat all files in the project according to java conventions.
This commit is contained in:
@@ -11,31 +11,31 @@ import redis.clients.jedis.exceptions.JedisException;
|
||||
*
|
||||
*/
|
||||
public class SafeEncoder {
|
||||
public static byte[][] encodeMany(final String... strs){
|
||||
byte[][] many = new byte[strs.length][];
|
||||
for(int i=0;i<strs.length;i++){
|
||||
many[i] = encode(strs[i]);
|
||||
}
|
||||
return many;
|
||||
public static byte[][] encodeMany(final String... strs) {
|
||||
byte[][] many = new byte[strs.length][];
|
||||
for (int i = 0; i < strs.length; i++) {
|
||||
many[i] = encode(strs[i]);
|
||||
}
|
||||
|
||||
return many;
|
||||
}
|
||||
|
||||
public static byte[] encode(final String str) {
|
||||
try {
|
||||
if (str == null) {
|
||||
throw new JedisDataException(
|
||||
"value sent to redis cannot be null");
|
||||
}
|
||||
return str.getBytes(Protocol.CHARSET);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new JedisException(e);
|
||||
}
|
||||
try {
|
||||
if (str == null) {
|
||||
throw new JedisDataException(
|
||||
"value sent to redis cannot be null");
|
||||
}
|
||||
return str.getBytes(Protocol.CHARSET);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new JedisException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String encode(final byte[] data) {
|
||||
try {
|
||||
return new String(data, Protocol.CHARSET);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new JedisException(e);
|
||||
}
|
||||
try {
|
||||
return new String(data, Protocol.CHARSET);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new JedisException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user