public interface GMService extends GMExecutor
Implementations of this interface must ensure all the methods defined in this interface are thread safe.
Modifier and Type | Method and Description |
---|---|
String |
execute(List<String> command)
Executes the command using the underlying GraphicsMagick process.
|
String |
execute(String command,
String... arguments)
Executes the GraphisMagick command and return the result.
|
GMConnection |
getConnection()
Gets an instance of
GMConnection . |
String execute(@Nonnull String command, String... arguments) throws IOException, GMException, GMServiceException
This is a convenient method to get the connection
,
execute
the command once and close
it. It is functionally equivalent to code below, but actual implementation may optimize this for better
efficiency.
final GMConnection connection = gmService.getConnection(); try { return connection.execute(command, argument1, argument2, ...); } finally { connection.close(); }
This method is thread safe.
execute
in interface GMExecutor
command
- the command to be executedarguments
- arguments of the command.NullPointerException
- when command is nullIOException
- when GM encounter IO error executing the commandGMException
- when GraphicsMagick returns non-IO error executing the commandGMServiceException
- when there is error communicating with the underlying GraphicsMagick processGMExecutor.execute(List)
String execute(@Nonnull List<String> command) throws IOException, GMException, GMServiceException
This is a convenient method to get the connection
, execute
the command once and close
it. It is functionally equivalent to code below,
but actual implementation may optimize this for better efficiency.
final GMConnection connection = gmService.getConnection(); try { return connection.execute(command); } finally { connection.close(); }
This method is thread safe.
execute
in interface GMExecutor
command
- the command and arguments to be executedNullPointerException
- when command is nullIllegalArgumentException
- when command is an empty list.IOException
- when GM encounter IO error executing the commandGMException
- when GraphicsMagick returns non-IO error executing the commandGMServiceException
- when there is error communicating with the underlying GraphicsMagick processexecute(String, String...)
@Nonnull GMConnection getConnection() throws GMServiceException
GMConnection
. Depends on the implementation, the instance can be newly created or
from a pool.
This method is thread safe.
GMServiceException
- when communicate error occurs between the physical GraphicsMagick process.Copyright © 2013. All Rights Reserved.