UnwiredtecDocumentation : RingtoneCreatorJavaInputOutput

I/O operations


You can use the following methods for performing I/O operations with ringtones:

Load ringtones


You can load ringtones from files, URLs and from byte arrays.

Load a ringtone from file:

public static Ringtone openRingtone(String format, byte[] bytes)


public static Ringtone openRingtone(String format, InputStream stream) throws IOException


public static Ringtone openRingtone(String format, String filename) throws IOException


Starting with version 2.3 the format parameter is optional. This means that Ringtone Creator is able to determine the format of the provided file automatically. If the file doesn't seem to correspond to any format, a RingtoneParseException gets thrown.

RingtoneParseException is a RuntimeException instance and doesn't always need to be caught.

Save ringtones


public void saveRingtone(String format, OutputStream stream) throws IOException


public void saveRingtone(String format, String filename) throws IOException


public final byte[] getRingtoneBytes(String format) throws RingtoneConvertException


RingtoneConvertException is a RuntimeException instance and doesn't always need to be caught.

Determine ringtone format


You can determine ringtone format by its bytes.

Get ringtone format:

public static final String getFormat(byte[] bytes) throws IOException, RingtoneParseException


RingtoneParseException is a RuntimeException instance and doesn't always need to be caught.

You can pass obtained string format value as the first parameter to openRingtone(), saveRingtone() or getRingtoneBytes() methods.