Looking for a way to integrate internet radio stations into your Java application? RadioBrowser4j is a lightweight Java library that provides easy access to the RadioBrowser database — one of the largest open collections of internet radio stations available.
What is RadioBrowser4j?
RadioBrowser4j is a Java API client for the RadioBrowser internet radio station repository. The library lets applications retrieve radio station URLs, streams, and metadata without the complexity of handling HTTP requests directly.
Whether you’re building a desktop radio player, a mobile Android app, or a server-side service, RadioBrowser4j gives you a clean Java interface to:
- Search and list radio stations by name, country, codec, and more
- Perform advanced full-text searches
- Browse countries, languages, and codecs
- Get server statistics
- Edit station information
Key Features
- Lightweight: Built with URLConnection and GSON instead of heavy JAX-RS libraries — works seamlessly on Android
- Stream-based: Uses Java Streams for efficient, lazy-loading result sets
- Well-tested: API tested with WireMock for reliable offline testing
- Active maintenance: Regular updates with dependency improvements and new features
Getting Started
Add the Dependency
Maven:
<dependency>
<groupId>de.sfuhrm</groupId>
<artifactId>radiobrowser4j</artifactId>
<version>3.2.0</version>
</dependency>
Gradle:
implementation 'de.sfuhrm:radiobrowser4j:3.2.0'
Discover an Endpoint and Create a Client
The library handles endpoint discovery automatically:
String userAgent = "my-app/1.0";
Optional<String> endpoint = new EndpointDiscovery(userAgent).discover();
RadioBrowser radioBrowser = new RadioBrowser(
ConnectionParams.builder()
.apiUrl(endpoint.get())
.userAgent(userAgent)
.timeout(5000)
.build());
List Stations
radioBrowser.listStations(ListParameter.create().order(FieldName.NAME))
.limit(64)
.forEach(station -> System.out.printf("%s: %s%n", station.getName(), station.getUrl()));
Filter by Country
radioBrowser.listStations(ListParameter.create()
.countryCode("US")
.order(FieldName.BITRATE))
.limit(20)
.forEach(station -> System.out.printf("%s (%skbps)%n", station.getName(), station.getBitrate()));
Advanced Search
For more complex queries, use the advanced search:
AdvancedSearch query = AdvancedSearch.create()
.withName("jazz")
.withCountryCode("US")
.withBitRateMin(128)
.withOrder(FieldName.NAME);
List<Station> result = radioBrowser.listStationsWithAdvancedSearch(query);
Android Support
RadioBrowser4j works on Android out of the box. If you’re using ProGuard or R8 code shrinking, add these rules to your configuration:
-dontwarn lombok**
-keep class de.sfuhrm.radiobrowser4j.** { *; }
-keepattributes Signature
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.reflect.TypeToken
Learn More
License
RadioBrowser4j is licensed under the Apache License 2.0, making it suitable for both open source and commercial projects.
*RadioBrowser4j is actively maintained and open for contributions. Check the GitHub repository for source code, tests, and more examples.*