// Path: src/main/java/com/groupon/vertx/memcache/MemcacheException.java
// public class MemcacheException extends RuntimeException {
//     private static final long serialVersionUID = -386882705199382789L;
// 
//     public MemcacheException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/client/JsendStatus.java
// public enum JsendStatus {
//     success,
//     error,
//     fail;
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/client/response/ModifyCommandResponse.java
// public final class ModifyCommandResponse extends MemcacheCommandResponse {
//     private final Integer data;
// 
//     private ModifyCommandResponse(Builder builder) {
//         super(builder);
//         data = builder.data;
//     }
// 
//     public Integer getData() {
//         return data;
//     }
// 
//     /**
//      * Builder for the ModifyCommandResponse
//      */
//     public static class Builder extends AbstractBuilder<Builder, ModifyCommandResponse> {
//         private Integer data;
// 
//         @Override
//         protected Builder self() {
//             return this;
//         }
// 
//         public Builder setData(Integer value) {
//             data = value;
//             return self();
//         }
// 
//         @Override
//         public ModifyCommandResponse build() {
//             return new ModifyCommandResponse(this);
//         }
//     }
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/stream/MemcacheResponseType.java
// public enum MemcacheResponseType {
//     VALUE("VALUE ", false),
//     STORED("STORED", true),
//     DELETED("DELETED", true),
//     TOUCHED("TOUCHED", true),
//     NOT_STORED("NOT_STORED", true),
//     EXISTS("EXISTS", true),
//     NOT_FOUND("NOT_FOUND", true),
//     END("END", true),
//     ERROR("ERROR", true),
//     CLIENT_ERROR("CLIENT ERROR", false),
//     SERVER_ERROR("SERVER ERROR", false);
// 
//     public final String type;
//     public final boolean exact;
// 
//     MemcacheResponseType(String type, boolean exact) {
//         this.type = type;
//         this.exact = exact;
//     }
// 
//     public boolean matches(ByteArrayOutputStream line) {
//         boolean match;
//         try {
//             if (!exact) {
//                 match = line.toString("UTF-8").startsWith(type);
//             } else {
//                 match = line.toString("UTF-8").equals(type);
//             }
//         } catch (UnsupportedEncodingException e) {
//             match = false;
//         }
//         return match;
//     }
// }


import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import com.groupon.vertx.memcache.MemcacheException;
import com.groupon.vertx.memcache.client.JsendStatus;
import com.groupon.vertx.memcache.client.response.ModifyCommandResponse;
import com.groupon.vertx.memcache.stream.MemcacheResponseType;
import com.groupon.vertx.utils.Logger;
/**
 * Copyright 2014 Groupon.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.groupon.vertx.memcache.parser;



/**
 * This supports the parsing logic for memcache storage commands INCR and DECR.
 *
 * @author Stuart Siegrist (fsiegrist at groupon dot com)
 * @since 1.0.0
 */
public class ModifyLineParser extends BaseLineParser<ModifyCommandResponse, ModifyCommandResponse.Builder> {
    private static final Logger log = Logger.getLogger(ModifyLineParser.class);
    private static final MemcacheResponseType[] RESPONSE_TYPES = new MemcacheResponseType[] {
        MemcacheResponseType.NOT_FOUND
    };

    private ModifyCommandResponse.Builder builder;

    public ModifyLineParser() {
        builder = new ModifyCommandResponse.Builder();
    }

    @Override
// Path: src/main/java/com/groupon/vertx/memcache/MemcacheException.java
// public class MemcacheException extends RuntimeException {
//     private static final long serialVersionUID = -386882705199382789L;
// 
//     public MemcacheException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/client/JsendStatus.java
// public enum JsendStatus {
//     success,
//     error,
//     fail;
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/client/response/ModifyCommandResponse.java
// public final class ModifyCommandResponse extends MemcacheCommandResponse {
//     private final Integer data;
// 
//     private ModifyCommandResponse(Builder builder) {
//         super(builder);
//         data = builder.data;
//     }
// 
//     public Integer getData() {
//         return data;
//     }
// 
//     /**
//      * Builder for the ModifyCommandResponse
//      */
//     public static class Builder extends AbstractBuilder<Builder, ModifyCommandResponse> {
//         private Integer data;
// 
//         @Override
//         protected Builder self() {
//             return this;
//         }
// 
//         public Builder setData(Integer value) {
//             data = value;
//             return self();
//         }
// 
//         @Override
//         public ModifyCommandResponse build() {
//             return new ModifyCommandResponse(this);
//         }
//     }
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/stream/MemcacheResponseType.java
// public enum MemcacheResponseType {
//     VALUE("VALUE ", false),
//     STORED("STORED", true),
//     DELETED("DELETED", true),
//     TOUCHED("TOUCHED", true),
//     NOT_STORED("NOT_STORED", true),
//     EXISTS("EXISTS", true),
//     NOT_FOUND("NOT_FOUND", true),
//     END("END", true),
//     ERROR("ERROR", true),
//     CLIENT_ERROR("CLIENT ERROR", false),
//     SERVER_ERROR("SERVER ERROR", false);
// 
//     public final String type;
//     public final boolean exact;
// 
//     MemcacheResponseType(String type, boolean exact) {
//         this.type = type;
//         this.exact = exact;
//     }
// 
//     public boolean matches(ByteArrayOutputStream line) {
//         boolean match;
//         try {
//             if (!exact) {
//                 match = line.toString("UTF-8").startsWith(type);
//             } else {
//                 match = line.toString("UTF-8").equals(type);
//             }
//         } catch (UnsupportedEncodingException e) {
//             match = false;
//         }
//         return match;
//     }
// }


// Path: src/main/java/com/groupon/vertx/memcache/parser/ModifyLineParser.java
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import com.groupon.vertx.memcache.MemcacheException;
import com.groupon.vertx.memcache.client.JsendStatus;
import com.groupon.vertx.memcache.client.response.ModifyCommandResponse;
import com.groupon.vertx.memcache.stream.MemcacheResponseType;
import com.groupon.vertx.utils.Logger;

/**
 * Copyright 2014 Groupon.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.groupon.vertx.memcache.parser;



/**
 * This supports the parsing logic for memcache storage commands INCR and DECR.
 *
 * @author Stuart Siegrist (fsiegrist at groupon dot com)
 * @since 1.0.0
 */
public class ModifyLineParser extends BaseLineParser<ModifyCommandResponse, ModifyCommandResponse.Builder> {
    private static final Logger log = Logger.getLogger(ModifyLineParser.class);
    private static final MemcacheResponseType[] RESPONSE_TYPES = new MemcacheResponseType[] {
        MemcacheResponseType.NOT_FOUND
    };

    private ModifyCommandResponse.Builder builder;

    public ModifyLineParser() {
        builder = new ModifyCommandResponse.Builder();
    }

    @Override
    protected ModifyCommandResponse.Builder getResponseBuilder() {