Java仿千千静听音乐播放器源代码(8)

2019-09-02 13:17

}

}

} else { }

buffer.append('%'); buffer.append('u');

buffer.append(hex[(ch >>> 8)]); buffer.append(hex[(0x00FF & ch)]);

return buffer.toString();

/**

* JavaScript unescape函数算法 * @param value * @return */

public static String unescape(String value) {

StringBuffer buffer = new StringBuffer(); int i = 0;

int length = value.length(); int ch = 0;

while (i < length) {

ch = value.charAt(i); if ('A' <= ch && ch <= 'Z')

buffer.append((char) ch); buffer.append((char) ch); buffer.append((char) ch);

|| ch == '~' || ch == '*' || ch == '\\'' || ch == '(' || ch == ')')

else if ('a' <= ch && ch <= 'z') else if ('0' <= ch && ch <= '9')

else if (ch == '-' || ch == '_' || ch == '.' || ch == '!'

buffer.append((char) ch); int cint = 0;

if ('u' != value.charAt(i + 1)) {

cint = (cint << 4) | val[value.charAt(i + 1)]; cint = (cint << 4) | val[value.charAt(i + 2)]; i += 2;

cint = (cint << 4) | val[value.charAt(i + 2)]; cint = (cint << 4) | val[value.charAt(i + 3)]; cint = (cint << 4) | val[value.charAt(i + 4)]; cint = (cint << 4) | val[value.charAt(i + 5)]; i += 5;

else if (ch == '%') {

} else {

- 36 -

}

}

}

}

buffer.append((char) cint); buffer.append((char) ch);

} else i++;

return buffer.toString();

/**

* 10进制转换为16进制 */

public static String Hex10To16(int value) { }

private static String getHex10To16Value(int value) { }

if (value < 10)

return value + \; return \; return \; return \; return \; return \; return \; return \; else if (value == 10) else if (value == 11) else if (value == 12) else if (value == 13) else if (value == 14) else if (value == 15) else

String hexValue = \;

if (value < 256 && value > -1) { }

return hexValue;

int number = value / 16;

hexValue += Util.getHex10To16Value(number); number = value % 16;

hexValue += Util.getHex10To16Value(number); return hexValue;

- 37 -

Core.java

package player.core;

import player.user.CrystalPlayer; import javax.media.*;

import player.module.ListItem; import player.lyrics.*;

public class Core {

public boolean isPaused() { }

return paused;

public void setVolume(float volume) { }

this.volume = volume; if (player != null)

player.getGainControl().setLevel(volume);

protected void setPaused(boolean paused) { }

this.paused = paused;

protected void setPlayed(boolean played) { }

this.played = played;

public Core(CrystalPlayer frame) { }

this.frame = frame;

private CrystalPlayer frame = null; private Player player = null; private boolean played = false; private boolean paused = false; private float volume = 1.0f;

private MediaAdapter adapter = new MediaAdapter(this); private LyricsContent lyrics = null; private ListItem item = null;

- 38 -

public void play(ListItem item) {

this.item = item; if (item != null) {

try {

frame.getLyrics().removeAllLyrics();

player = Manager.createPlayer(item.getFile().toURL()); player.addControllerListener(adapter); lyrics = item.getMuisc().getLyrics(); frame.getLyrics().setVisible(

lyrics != null && frame.isVisible()

&& frame.isShowLyrics());

public void setMediaSeconds(int seconds) { }

if (player != null)

player.setMediaTime(new Time((double) seconds));

public ListItem getItem() { }

return item;

public LyricsContent getLyrics() { }

return lyrics;

public CrystalPlayer getFrame() { }

return frame;

public Player getPlayer() { }

return player;

public float getVolume() { }

return volume;

public boolean isPlayed() { }

return played;

frame.readMuisc(item.getMuisc()); player.realize();

} catch (Exception e) {

- 39 -

}

}

}

}

e.printStackTrace();

public void start() { }

public void pause() { }

public void stop() { }

protected void deallocate() { }

item = null; lyrics = null; player = null;

frame.readMuisc(null);

frame.getLyrics().setVisible(false); frame.getVideo().addVideo(null); this.setPaused(false); this.setPlayed(false); if (frame.isNext())

frame.next(); if (player != null)

player.setMediaTime(player.getDuration()); if (player != null)

player.stop(); if (player != null)

player.start();

MediaAdapter.java

package player.core;

import javax.media.*; import java.util.ArrayList; import player.module.LyricsItem; import java.util.*; import player.lyrics.*;

public class MediaAdapter extends ControllerAdapter{

- 40 -


Java仿千千静听音乐播放器源代码(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:FLUENT udf中文资料ch8

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: