Binks.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:binks.jar 作者:
public static void main(String[] args) {
    new Thread(() -> {
        while (true) {
            int delay = (RANDOM.nextInt(MAX_DELAY_SECONDS - MIN_DELAY_SECONDS) + MIN_DELAY_SECONDS) * 1000;
            try (
                    ByteArrayInputStream bais = new ByteArrayInputStream(AUDIO_BYTES);
                    AudioInputStream audioIn = AudioSystem.getAudioInputStream(bais);
            ) {
                Clip clip = AudioSystem.getClip();
                clip.open(audioIn);

                Thread.currentThread().sleep(delay);
                clip.start();
            } catch (InterruptedException | IOException | LineUnavailableException
                    | UnsupportedAudioFileException ex) {
                ex.printStackTrace();
            }
        }
    }).start();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号