Basic Java Upload
// Simple file upload and transformation
import io.filestack.FilestackClient;
import io.filestack.FileLink;
Config config = new Config("YOUR_API_KEY");
FilestackClient client = new FilestackClient(config);
// Upload a file
String path = "/path/to/image.jpg";
UploadResponse response = client.upload(path, false);
FileLink fileLink = response.getFileLink();
// Transform the image
Transform transform = client.imageTransform(fileLink)
.resize(300, 300)
.quality(80);
System.out.println("Transformed: " + transform.url());Built for Java Enterprise
Our Java SDK follows enterprise Java conventions and integrates seamlessly with popular frameworks and build tools.
Thread-Safe Design
Fully thread-safe implementation designed for high-concurrency enterprise applications with proper synchronization and connection pooling.
Spring Boot Integration
Auto-configuration support, starter dependencies, and annotations for seamless integration with Spring Boot applications.
Reactive Support
Full support for reactive programming with Project Reactor, including non-blocking I/O operations and backpressure handling.
Observability
Built-in metrics, tracing, and health checks with Micrometer integration for comprehensive application monitoring.
High Performance
Optimized for throughput with connection pooling, HTTP/2 support, and efficient memory management for large file operations.
Error Resilience
Robust error handling with circuit breakers, retry policies, and graceful degradation for production-ready applications.
Trusted by innovative companies worldwide
Enterprise-Ready Architecture
Designed for mission-critical applications with enterprise-grade features, security, and scalability. Perfect for microservices, batch processing, and high-throughput systems.
Lightweight, cloud-native design with service discovery and configuration management support
CompletableFuture support with configurable thread pools for non-blocking operations
Integration with Prometheus, Grafana, and APM tools for comprehensive observability
OAuth 2.0, JWT tokens, and configurable security policies for enterprise compliance
Spring Batch integration for processing large volumes of files with job scheduling
Spring Boot Integration
// Spring Boot integration example
@RestController
@RequestMapping("/api/files")
public class FileController {
@Autowired
private FilestackService filestackService;
@PostMapping("/upload")
public Mono>
uploadFile(@RequestParam MultipartFile file) {
return filestackService.uploadAsync(file)
.map(fileLink -> {
FileResponse response = new FileResponse();
response.setUrl(fileLink.getUrl());
response.setHandle(fileLink.getHandle());
return ResponseEntity.ok(response);
})
.onErrorMap(throwable ->
new FileUploadException("Upload failed", throwable)
);
}
@GetMapping("/transform/{handle}")
public ResponseEntity
transformImage(@PathVariable String handle) {
Transform transform = filestackService
.getClient()
.imageTransform(new FileLink(handle))
.resize(800, 600)
.quality(85)
.format(ImageFormat.WEBP);
return ResponseEntity.ok(transform.url());
}
}
@Service
public class FilestackService {
private final FilestackClient client;
public FilestackService(@Value("${filestack.api-key}")
String apiKey) {
Config config = new Config(apiKey);
this.client = new FilestackClient(config);
}
public Mono uploadAsync(MultipartFile file) {
return Mono.fromCallable(() ->
client.upload(file.getInputStream(),
file.getOriginalFilename())
).subscribeOn(Schedulers.boundedElastic());
}
}
Build Tool Integration
Easy integration with Maven, Gradle, and SBT. Compatible with Java 8+ and all modern Java frameworks.
Add Dependency
com.filestack filestack-java 1.10.1implementation 'com.filestack:filestack-java:1.10.1'libraryDependencies += "com.filestack" % "filestack-java" % "1.10.1"Basic Usage
Initialize and use the client:
Config config = new Config("YOUR_API_KEY");
FilestackClient client = new FilestackClient(config);
Complete Java Implementation
// Complete working example
import io.filestack.FilestackClient;
import io.filestack.FileLink;
import io.filestack.Config;
import io.filestack.responses.UploadResponse;
import io.filestack.transforms.Transform;
public class FilestackExample {
private static final String API_KEY = "YOUR_API_KEY";
public static void main(String[] args) {
// Initialize client
Config config = new Config(API_KEY);
FilestackClient client = new FilestackClient(config);
try {
// Upload a file
String filePath = "/path/to/image.jpg";
UploadResponse response = client.upload(filePath, false);
FileLink fileLink = response.getFileLink();
System.out.println("Upload successful: " + fileLink.getUrl());
// Create a thumbnail
Transform thumbnail = client.imageTransform(fileLink)
.resize(200, 200)
.crop(200, 200)
.quality(80)
.format(ImageFormat.WEBP);
System.out.println("Thumbnail: " + thumbnail.url());
// Batch process multiple files
String[] imagePaths = {"image1.jpg", "image2.png", "image3.gif"};
processImages(client, imagePaths);
} catch (Exception e) {
System.err.println("Error: " + e.getMessage());
e.printStackTrace();
}
}
private static void processImages(FilestackClient client,
String[] imagePaths) {
for (String path : imagePaths) {
try {
// Upload original
UploadResponse response = client.upload(path, false);
FileLink original = response.getFileLink();
// Create multiple sizes
Transform small = client.imageTransform(original)
.resize(300, 300).quality(85);
Transform medium = client.imageTransform(original)
.resize(600, 600).quality(90);
System.out.println("Processed " + path + ":");
System.out.println(" Small: " + small.url());
System.out.println(" Medium: " + medium.url());
} catch (Exception e) {
System.err.println("Failed to process " + path + ": " + e.getMessage());
}
}
}
}
Implement Java File Management
Join enterprise teams worldwide who trust Filestack’s Java SDK for mission-critical file management. Scale with confidence using our battle-tested, enterprise-ready solution.