// Path: src/main/java/org/gm4java/engine/GMConnection.java
// public interface GMConnection extends GMExecutor {
//     /**
//      * Close {@linkplain GMConnection} and destroy the underlying GraphicsMagick process.
//      * 
//      * @throws GMServiceException
//      *             when there is error communicating with the underlying GraphicsMagick process
//      */
//     void close() throws GMServiceException;
// }
// 
// Path: src/main/java/org/gm4java/engine/GMException.java
// public class GMException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Construct a new instance of exception.
//      * 
//      * @param message
//      *            the detailed message returned by GraphicsMagick
//      */
//     public GMException(String message) {
//         super(message);
//     }
// 
// }
// 
// Path: src/main/java/org/gm4java/engine/GMServiceException.java
// public class GMServiceException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Constructs a new exception with given message.
//      * 
//      * @param message
//      *            the detailed message of the exception.
//      */
//     public GMServiceException(String message) {
//         super(message);
//     }
// 
//     /**
//      * Constructs a new exception with given message and cause.
//      * 
//      * @param message
//      *            the detailed message of the exception.
//      * @param cause
//      *            the cause of the error.
//      */
//     public GMServiceException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }


import org.gm4java.engine.GMConnection;
import org.gm4java.engine.GMException;
import org.gm4java.engine.GMServiceException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Writer;
import java.util.Arrays;
import java.util.List;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
    }

    private void sendCommand(String command, @Nonnull List<String> arguments) throws GMServiceException {
        Writer toGm = process.getWriter();
        try {
            if (command != null) toGm.write(command);
            for (String s : arguments) {
                final byte quote = '"';
                toGm.write(" ");
                toGm.write(quote);
                int start = 0, index = s.indexOf(quote);
                if (index < 0) {
                    toGm.write(s);
                } else {
                    do {
                        toGm.write(s, start, ++index - start);
                        toGm.write(quote);
                        start = index;
                        index = s.indexOf(quote, start);
                    } while (index >= 0);
                }
                toGm.write(quote);
            }
            toGm.write(EOL);
            toGm.flush();
        } catch (IOException e) {
            throw new GMServiceException(e.getMessage(), e);
        }
    }

// Path: src/main/java/org/gm4java/engine/GMConnection.java
// public interface GMConnection extends GMExecutor {
//     /**
//      * Close {@linkplain GMConnection} and destroy the underlying GraphicsMagick process.
//      * 
//      * @throws GMServiceException
//      *             when there is error communicating with the underlying GraphicsMagick process
//      */
//     void close() throws GMServiceException;
// }
// 
// Path: src/main/java/org/gm4java/engine/GMException.java
// public class GMException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Construct a new instance of exception.
//      * 
//      * @param message
//      *            the detailed message returned by GraphicsMagick
//      */
//     public GMException(String message) {
//         super(message);
//     }
// 
// }
// 
// Path: src/main/java/org/gm4java/engine/GMServiceException.java
// public class GMServiceException extends Exception {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * Constructs a new exception with given message.
//      * 
//      * @param message
//      *            the detailed message of the exception.
//      */
//     public GMServiceException(String message) {
//         super(message);
//     }
// 
//     /**
//      * Constructs a new exception with given message and cause.
//      * 
//      * @param message
//      *            the detailed message of the exception.
//      * @param cause
//      *            the cause of the error.
//      */
//     public GMServiceException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
// }


// Path: src/main/java/org/gm4java/engine/support/BasicGMConnection.java
import org.gm4java.engine.GMConnection;
import org.gm4java.engine.GMException;
import org.gm4java.engine.GMServiceException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Writer;
import java.util.Arrays;
import java.util.List;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

    }

    private void sendCommand(String command, @Nonnull List<String> arguments) throws GMServiceException {
        Writer toGm = process.getWriter();
        try {
            if (command != null) toGm.write(command);
            for (String s : arguments) {
                final byte quote = '"';
                toGm.write(" ");
                toGm.write(quote);
                int start = 0, index = s.indexOf(quote);
                if (index < 0) {
                    toGm.write(s);
                } else {
                    do {
                        toGm.write(s, start, ++index - start);
                        toGm.write(quote);
                        start = index;
                        index = s.indexOf(quote, start);
                    } while (index >= 0);
                }
                toGm.write(quote);
            }
            toGm.write(EOL);
            toGm.flush();
        } catch (IOException e) {
            throw new GMServiceException(e.getMessage(), e);
        }
    }

    private String readResult() throws IOException, GMServiceException, GMException {