All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.whitemagic2014.tts.TTSVoice Maven / Gradle / Ivy

There is a newer version: 1.2.3
Show newest version
package io.github.whitemagic2014.tts;

import com.alibaba.fastjson.JSON;
import io.github.whitemagic2014.tts.bean.Voice;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;

public class TTSVoice {

    private static List voices;

    static {
        ClassLoader classLoader = TTSVoice.class.getClassLoader();
        StringBuilder sb = new StringBuilder();
        try (InputStream inputStream = classLoader.getResourceAsStream("voicesList.json");
             BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
            String line = "";
            while ((line = br.readLine()) != null) {
                sb.append(line);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        voices = JSON.parseArray(sb.toString(), Voice.class);
    }

    public static List provides() {
        return voices;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy