Search in sources :

Example 6 with ByteArrayOutputStreamPayload

use of com.ctrip.xpipe.payload.ByteArrayOutputStreamPayload in project x-pipe by ctripcorp.

the class KinfoCommand method format.

protected ReplicationStoreMeta format(Object payload) {
    ByteArrayOutputStreamPayload data = (ByteArrayOutputStreamPayload) payload;
    String buff = new String(data.getBytes(), Codec.defaultCharset);
    logger.info("[format]{}", buff);
    ReplicationStoreMeta meta = null;
    meta = JSON.parseObject(buff, ReplicationStoreMeta.class);
    if (valid(meta)) {
        return meta;
    } else {
        throw new XpipeRuntimeException("[format][wrong meta]" + meta);
    }
}
Also used : ReplicationStoreMeta(com.ctrip.xpipe.redis.core.store.ReplicationStoreMeta) ByteArrayOutputStreamPayload(com.ctrip.xpipe.payload.ByteArrayOutputStreamPayload) XpipeRuntimeException(com.ctrip.xpipe.exception.XpipeRuntimeException)

Aggregations

ByteArrayOutputStreamPayload (com.ctrip.xpipe.payload.ByteArrayOutputStreamPayload)6 ByteArrayWritableByteChannel (com.ctrip.xpipe.payload.ByteArrayWritableByteChannel)2 Test (org.junit.Test)2 XpipeRuntimeException (com.ctrip.xpipe.exception.XpipeRuntimeException)1 StringInOutPayload (com.ctrip.xpipe.payload.StringInOutPayload)1 AbstractRedisTest (com.ctrip.xpipe.redis.core.AbstractRedisTest)1 RedisRuntimeException (com.ctrip.xpipe.redis.core.exception.RedisRuntimeException)1 RedisError (com.ctrip.xpipe.redis.core.protocal.error.RedisError)1 ReplicationStoreMeta (com.ctrip.xpipe.redis.core.store.ReplicationStoreMeta)1 IOException (java.io.IOException)1