EMMA Coverage Report (generated Tue Oct 27 11:32:50 PDT 2009)
[all classes][net.spy.memcached.protocol.binary]

COVERAGE SUMMARY FOR SOURCE FILE [StatsOperationImpl.java]

nameclass, %method, %block, %line, %
StatsOperationImpl.java100% (1/1)100% (3/3)100% (81/81)100% (17/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StatsOperationImpl100% (1/1)100% (3/3)100% (81/81)100% (17/17)
StatsOperationImpl (String, StatsOperation$Callback): void 100% (1/1)100% (13/13)100% (3/3)
finishedPayload (byte []): void 100% (1/1)100% (59/59)100% (12/12)
initialize (): void 100% (1/1)100% (9/9)100% (2/2)

1package net.spy.memcached.protocol.binary;
2 
3import java.io.IOException;
4 
5import net.spy.memcached.ops.OperationState;
6import net.spy.memcached.ops.StatsOperation;
7 
8public class StatsOperationImpl extends OperationImpl
9        implements StatsOperation {
10 
11        private static final int CMD = 0x10;
12        private final String key;
13 
14        public StatsOperationImpl(String arg, StatsOperation.Callback c) {
15                super(CMD, generateOpaque(), c);
16                key=(arg == null) ? "" : arg;
17        }
18 
19        @Override
20        public void initialize() {
21                prepareBuffer(key, 0, EMPTY_BYTES);
22        }
23 
24        @Override
25        protected void finishedPayload(byte[] pl) throws IOException {
26                if(keyLen > 0) {
27                        final byte[] keyBytes=new byte[keyLen];
28                        final byte[] data=new byte[pl.length - keyLen];
29                        System.arraycopy(pl, 0, keyBytes, 0, keyLen);
30                        System.arraycopy(pl, keyLen, data, 0, pl.length-keyLen);
31                        Callback cb=(Callback)getCallback();
32                        cb.gotStat(new String(keyBytes, "UTF-8"),
33                                        new String(data, "UTF-8"));
34                } else {
35                        getCallback().receivedStatus(STATUS_OK);
36                        transitionState(OperationState.COMPLETE);
37                }
38                resetInput();
39        }
40 
41}

[all classes][net.spy.memcached.protocol.binary]
EMMA 2.0.5312 (C) Vladimir Roubtsov