Skip to content

aioobe/cloudconvert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudConvert Java API

Jersey-client based implementation of the CloudConvert.com REST API.

Dependency

<dependency>
    <groupId>org.aioobe.cloudconvert</groupId>
    <artifactId>client</artifactId>
    <version>1.1</version>
</dependency>

Example Usage

// Create service object
CloudConvertService service = new CloudConvertService("<api key>");

// Create conversion process
ConvertProcess process = service.startProcess("jpg", "png");

// Perform conversion
process.startConversion(new File("test.jpg"));

// Wait for result
ProcessStatus status;
waitLoop: while (true) {
    status = process.getStatus();
    
    switch (status.step) {
    case FINISHED: break waitLoop;
    case ERROR: throw new RuntimeException(status.message);
    }
    
    // Be gentle
    Thread.sleep(200);
}

// Download result
service.download(status.output.url, new File("output.png"));

// Clean up
process.delete();

About

Java API for the CloudConvert Service

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages