|
@@ -0,0 +1,30 @@
|
|
|
|
+package cn.efunbox.audio.utils;
|
|
|
|
+
|
|
|
|
+import javazoom.jl.decoder.Bitstream;
|
|
|
|
+import javazoom.jl.decoder.BitstreamException;
|
|
|
|
+import javazoom.jl.decoder.Header;
|
|
|
|
+
|
|
|
|
+import java.io.BufferedInputStream;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.net.URL;
|
|
|
|
+import java.net.URLConnection;
|
|
|
|
+
|
|
|
|
+public class Test {
|
|
|
|
+ public static void main(String[] args) throws IOException, BitstreamException {
|
|
|
|
+ URL urlfile = new URL("http://sc1.111ttt.com/2015/1/06/06/99060941326.mp3");
|
|
|
|
+ URLConnection con = null;
|
|
|
|
+ try {
|
|
|
|
+ con = urlfile.openConnection();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ // TODO Auto-generated catch block
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ int b = con.getContentLength();//
|
|
|
|
+ BufferedInputStream bis = new BufferedInputStream(con.getInputStream());
|
|
|
|
+ Bitstream bt = new Bitstream(bis);
|
|
|
|
+ Header h = bt.readFrame();
|
|
|
|
+ int time = (int) h.total_ms(b);
|
|
|
|
+ System.out.println(time / 1000);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|