亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? converter.java

?? Java編寫的一個(gè)mp3播放器源代碼,對(duì)于想做這方面工作的網(wǎng)友來(lái)說(shuō)還是有很大的參考價(jià)值的
?? JAVA
字號(hào):
/*
 * 11/19/04 1.0 moved to LGPL.
 * 12/12/99 Original verion. mdm@techie.com.
 *-----------------------------------------------------------------------
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library General Public License as published
 *   by the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Library General Public License for more details.
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *----------------------------------------------------------------------
 */

package javazoom.jl.converter;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

import javazoom.jl.decoder.Bitstream;
import javazoom.jl.decoder.Decoder;
import javazoom.jl.decoder.Header;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.decoder.Obuffer;

/**
 * The <code>Converter</code> class implements the conversion of
 * an MPEG audio file to a .WAV file. To convert an MPEG audio stream,
 * just create an instance of this class and call the convert()
 * method, passing in the names of the input and output files. You can
 * pass in optional <code>ProgressListener</code> and
 * <code>Decoder.Params</code> objects also to customize the conversion.
 *
 * @author	MDM		12/12/99
 * @since	0.0.7
 */
public class Converter
{
	/**
	 * Creates a new converter instance.
	 */
	public Converter()
	{
	}

	public synchronized void convert(String sourceName, String destName)
		throws JavaLayerException
	{
		convert(sourceName, destName, null, null);
	}

	public synchronized void convert(String sourceName, String destName,
		ProgressListener progressListener)
		throws JavaLayerException
	{
		convert(sourceName, destName, progressListener, null);
	}


	public void convert(String sourceName, String destName,
		ProgressListener progressListener, Decoder.Params decoderParams)
		throws JavaLayerException
	{
		if (destName.length()==0)
			destName = null;
		try {
			InputStream in = openInput(sourceName);
			convert(in, destName, progressListener, decoderParams);
			in.close();
		} catch(IOException ioe) {
			throw new JavaLayerException(ioe.getLocalizedMessage(), ioe);
		}
	}

	public synchronized void convert(InputStream sourceStream, String destName,
		ProgressListener progressListener, Decoder.Params decoderParams)
		throws JavaLayerException
	{
		if (progressListener==null)
			progressListener = PrintWriterProgressListener.newStdOut(
					PrintWriterProgressListener.NO_DETAIL);
		try {
			if (!(sourceStream instanceof BufferedInputStream))
				sourceStream = new BufferedInputStream(sourceStream);
			int frameCount = -1;
			if (sourceStream.markSupported()) {
				sourceStream.mark(-1);
				frameCount = countFrames(sourceStream);
				sourceStream.reset();
			}
			progressListener.converterUpdate(ProgressListener.UPDATE_FRAME_COUNT, frameCount, 0);


			Obuffer output = null;
			Decoder decoder = new Decoder(decoderParams);
			Bitstream stream = new Bitstream(sourceStream);

			if (frameCount==-1)
				frameCount = Integer.MAX_VALUE;

			int frame = 0;
			long startTime = System.currentTimeMillis();

			try
			{
				for (; frame<frameCount; frame++)
				{
					try
					{
						Header header = stream.readFrame();
						if (header==null)
							break;

						progressListener.readFrame(frame, header);

						if (output==null)
						{
							// REVIEW: Incorrect functionality.
							// the decoder should provide decoded
							// frequency and channels output as it may differ from
							// the source (e.g. when downmixing stereo to mono.)
							int channels = (header.mode()==Header.SINGLE_CHANNEL) ? 1 : 2;
							int freq = header.frequency();
							output = new WaveFileObuffer(channels, freq, destName);
							decoder.setOutputBuffer(output);
						}

						Obuffer decoderOutput = decoder.decodeFrame(header, stream);

						// REVIEW: the way the output buffer is set
						// on the decoder is a bit dodgy. Even though
						// this exception should never happen, we test to be sure.
						if (decoderOutput!=output)
							throw new InternalError("Output buffers are different.");


						progressListener.decodedFrame(frame, header, output);

						stream.closeFrame();

					}
					catch (Exception ex)
					{
						boolean stop = !progressListener.converterException(ex);

						if (stop)
						{
							throw new JavaLayerException(ex.getLocalizedMessage(), ex);
						}
					}
				}

			}
			finally
			{

				if (output!=null)
					output.close();
			}

			int time = (int)(System.currentTimeMillis()-startTime);
			progressListener.converterUpdate(ProgressListener.UPDATE_CONVERT_COMPLETE,
				time, frame);
		}
		catch (IOException ex)
		{
			throw new JavaLayerException(ex.getLocalizedMessage(), ex);
		}
	}


	protected int countFrames(InputStream in)
	{
		return -1;
	}


	protected InputStream openInput(String fileName)
		throws IOException
	{
		// ensure name is abstract path name
		File file = new File(fileName);
		InputStream fileIn = new FileInputStream(file);
		BufferedInputStream bufIn = new BufferedInputStream(fileIn);

		return bufIn;
	}


	/**
	 * This interface is used by the Converter to provide
	 * notification of tasks being carried out by the converter,
	 * and to provide new information as it becomes available.
	 */

	static public interface ProgressListener
	{
		public static final int	UPDATE_FRAME_COUNT = 1;

		/**
		 * Conversion is complete. Param1 contains the time
		 * to convert in milliseconds. Param2 contains the number
		 * of MPEG audio frames converted.
		 */
		public static final int UPDATE_CONVERT_COMPLETE = 2;


		/**
		 * Notifies the listener that new information is available.
		 *
		 * @param updateID	Code indicating the information that has been
		 *					updated.
		 *
		 * @param param1	Parameter whose value depends upon the update code.
		 * @param param2	Parameter whose value depends upon the update code.
		 *
		 * The <code>updateID</code> parameter can take these values:
		 *
		 * UPDATE_FRAME_COUNT: param1 is the frame count, or -1 if not known.
		 * UPDATE_CONVERT_COMPLETE: param1 is the conversion time, param2
		 *		is the number of frames converted.
		 */
		public void converterUpdate(int updateID, int param1, int param2);

		/**
		 * If the converter wishes to make a first pass over the
		 * audio frames, this is called as each frame is parsed.
		 */
		public void parsedFrame(int frameNo, Header header);

		/**
		 * This method is called after each frame has been read,
		 * but before it has been decoded.
		 *
		 * @param frameNo	The 0-based sequence number of the frame.
		 * @param header	The Header rerpesenting the frame just read.
		 */
		public void readFrame(int frameNo, Header header);

		/**
		 * This method is called after a frame has been decoded.
		 *
		 * @param frameNo	The 0-based sequence number of the frame.
		 * @param header	The Header rerpesenting the frame just read.
		 * @param o			The Obuffer the deocded data was written to.
		 */
		public void decodedFrame(int frameNo, Header header, Obuffer o);

		/**
		 * Called when an exception is thrown during while converting
		 * a frame.
		 *
		 * @param	t	The <code>Throwable</code> instance that
		 *				was thrown.
		 *
		 * @return <code>true</code> to continue processing, or false
		 *			to abort conversion.
		 *
		 * If this method returns <code>false</code>, the exception
		 * is propagated to the caller of the convert() method. If
		 * <code>true</code> is returned, the exception is silently
		 * ignored and the converter moves onto the next frame.
		 */
		public boolean converterException(Throwable t);

	}


	/**
	 * Implementation of <code>ProgressListener</code> that writes
	 * notification text to a <code>PrintWriter</code>.
	 */
	// REVIEW: i18n of text and order required.
	static public class PrintWriterProgressListener implements ProgressListener
	{
		static public final int	NO_DETAIL = 0;

		/**
		 * Level of detail typically expected of expert
		 * users.
		 */
		static public final int EXPERT_DETAIL = 1;

		/**
		 * Verbose detail.
		 */
		static public final int VERBOSE_DETAIL = 2;

		/**
		 * Debug detail. All frame read notifications are shown.
		 */
		static public final int DEBUG_DETAIL = 7;

		static public final int MAX_DETAIL = 10;

		private PrintWriter pw;

		private int detailLevel;

		static public PrintWriterProgressListener newStdOut(int detail)
		{
			return new PrintWriterProgressListener(
				new PrintWriter(System.out, true), detail);
		}

		public PrintWriterProgressListener(PrintWriter writer, int detailLevel)
		{
			this.pw = writer;
			this.detailLevel = detailLevel;
		}


		public boolean isDetail(int detail)
		{
			return (this.detailLevel >= detail);
		}

		public void converterUpdate(int updateID, int param1, int param2)
		{
			if (isDetail(VERBOSE_DETAIL))
			{
				switch (updateID)
				{
				case UPDATE_CONVERT_COMPLETE:
					// catch divide by zero errors.
					if (param2==0)
						param2 = 1;

					pw.println();
					pw.println("Converted "+param2+" frames in "+param1+" ms ("+
							   (param1/param2)+" ms per frame.)");
				}
			}
		}

		public void parsedFrame(int frameNo, Header header)
		{
			if ((frameNo==0) && isDetail(VERBOSE_DETAIL))
			{
				String headerString = header.toString();
				pw.println("File is a "+headerString);
			}
			else if (isDetail(MAX_DETAIL))
			{
				String headerString = header.toString();
				pw.println("Prased frame "+frameNo+": "+headerString);
			}
		}

		public void readFrame(int frameNo, Header header)
		{
			if ((frameNo==0) && isDetail(VERBOSE_DETAIL))
			{
				String headerString = header.toString();
				pw.println("File is a "+headerString);
			}
			else if (isDetail(MAX_DETAIL))
			{
				String headerString = header.toString();
				pw.println("Read frame "+frameNo+": "+headerString);
			}
		}

		public void decodedFrame(int frameNo, Header header, Obuffer o)
		{
			if (isDetail(MAX_DETAIL))
			{
				String headerString = header.toString();
				pw.println("Decoded frame "+frameNo+": "+headerString);
				pw.println("Output: "+o);
			}
			else if (isDetail(VERBOSE_DETAIL))
			{
				if (frameNo==0)
				{
					pw.print("Converting.");
					pw.flush();
				}

				if ((frameNo % 10)==0)
				{
					pw.print('.');
					pw.flush();
				}
			}
		}

		public boolean converterException(Throwable t)
		{
			if (this.detailLevel>NO_DETAIL)
			{
				t.printStackTrace(pw);
				pw.flush();
			}
			return false;
		}

	}


}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合久色欧美综合狠狠| 色综合久久六月婷婷中文字幕| fc2成人免费人成在线观看播放| 欧美视频一区二区在线观看| 欧美极品aⅴ影院| 日韩专区中文字幕一区二区| 91视频观看视频| 久久久www成人免费毛片麻豆| 日本在线不卡视频一二三区| 91国偷自产一区二区三区观看 | 激情综合一区二区三区| 日本久久精品电影| 国产精品成人免费在线| 国产一区二区三区在线观看精品 | 国产成人福利片| 日韩精品一区二区三区视频播放 | 成人av高清在线| www国产精品av| 久久电影网电视剧免费观看| 欧美一区二区三区在线观看| 亚洲一区二区三区中文字幕| eeuss鲁片一区二区三区| 国产欧美一区二区三区鸳鸯浴| 蜜臀av一级做a爰片久久| 91麻豆精品国产91久久久久久久久| 亚洲欧美日本在线| 99精品一区二区三区| 国产欧美日韩综合精品一区二区| 国内久久婷婷综合| 精品久久五月天| 极品美女销魂一区二区三区 | 欧美亚洲尤物久久| 一二三区精品视频| 色噜噜偷拍精品综合在线| 日韩一区有码在线| 色综合天天在线| 亚洲精品日产精品乱码不卡| 色先锋aa成人| 亚洲一区在线观看网站| 欧美视频一二三区| 天堂va蜜桃一区二区三区 | 欧美午夜精品免费| 亚洲一区二区成人在线观看| 欧美天天综合网| 亚洲大片精品永久免费| 欧美日韩dvd在线观看| 爽好久久久欧美精品| 日韩午夜小视频| 国产资源精品在线观看| 久久久久国产精品麻豆ai换脸| 国产·精品毛片| 亚洲欧美综合另类在线卡通| 91丨九色porny丨蝌蚪| 夜色激情一区二区| 这里只有精品免费| 黄页网站大全一区二区| 国产女主播视频一区二区| 92精品国产成人观看免费| 一区二区免费在线| 这里是久久伊人| 国产一区二区成人久久免费影院| 国产精品色婷婷| 91麻豆蜜桃一区二区三区| 亚洲国产毛片aaaaa无费看| 6080国产精品一区二区| 国产伦精品一区二区三区免费迷| 中文字幕精品一区二区精品绿巨人 | 91蝌蚪porny成人天涯| 亚洲一二三区不卡| 精品日韩一区二区| 成人黄色小视频在线观看| 一区二区三区中文字幕精品精品| 欧美精品视频www在线观看| 国内精品不卡在线| 国产精品国产馆在线真实露脸 | 99精品国产热久久91蜜凸| 亚洲国产成人高清精品| 日韩欧美国产1| 成人激情免费电影网址| 亚洲一区二区av电影| 精品黑人一区二区三区久久| 波波电影院一区二区三区| 亚洲高清视频在线| 欧美精品一区二区三区很污很色的| 成人理论电影网| 日韩国产精品91| 中文字幕av在线一区二区三区| 精品视频全国免费看| 精品一区二区久久久| 亚洲精品写真福利| 日韩精品一区二区三区在线播放| bt欧美亚洲午夜电影天堂| 日本亚洲欧美天堂免费| 国产精品天干天干在观线| 欧美日本不卡视频| 国产.欧美.日韩| 日本成人中文字幕| 亚洲视频免费在线| 精品久久久久久久久久久久久久久 | 国产丝袜在线精品| 欧美色综合影院| 国产99久久久国产精品免费看| 图片区小说区区亚洲影院| 国产精品久久久久久福利一牛影视| 欧美久久久久久久久久| www.成人在线| 九色|91porny| 亚洲国产精品一区二区久久| 国产亚洲福利社区一区| 欧美久久久久久久久| 99re亚洲国产精品| 久久99国产精品麻豆| 一区二区久久久久久| 日本一区二区动态图| 日韩欧美一区二区在线视频| 色网综合在线观看| 丁香网亚洲国际| 久久成人av少妇免费| 亚洲成人av资源| 亚洲美腿欧美偷拍| 国产欧美日韩一区二区三区在线观看| 欧美伦理视频网站| 色婷婷精品久久二区二区蜜臂av | 日本高清不卡视频| 成人小视频免费观看| 六月丁香综合在线视频| 亚洲一二三区不卡| 亚洲精品你懂的| 国产精品不卡一区| 日本一区二区电影| 国产日韩精品一区二区三区| 日韩精品一区二区三区三区免费| 欧美午夜精品一区二区蜜桃| 色婷婷综合久久久中文字幕| eeuss国产一区二区三区| 国产成人一区二区精品非洲| 狠狠色狠狠色综合| 久久99国产精品久久99| 美女诱惑一区二区| 日韩成人一区二区| 日本午夜精品视频在线观看| 肉色丝袜一区二区| 五月综合激情婷婷六月色窝| 亚洲综合自拍偷拍| 一区二区在线观看av| 亚洲欧美日韩小说| 一区二区三区资源| 亚洲一区欧美一区| 亚洲成人精品在线观看| 亚洲成av人影院在线观看网| 亚洲在线成人精品| 午夜成人免费电影| 日本欧美一区二区三区| 麻豆国产精品视频| 韩国一区二区三区| 国产精品亚洲成人| 国产成a人亚洲| 99久久免费国产| 色婷婷国产精品| 欧美性受xxxx黑人xyx| 欧美日韩国产综合久久| 欧美福利视频导航| 日韩视频一区二区在线观看| 欧美电影免费观看高清完整版在线 | 久久精品国内一区二区三区| 久久精工是国产品牌吗| 黄网站免费久久| 丁香六月综合激情| 色综合天天综合在线视频| 欧洲色大大久久| 欧美人与z0zoxxxx视频| 日韩久久久久久| 国产日韩欧美精品在线| 成人欧美一区二区三区黑人麻豆 | 国产色一区二区| 国产精品福利一区| 亚洲尤物在线视频观看| 日本女人一区二区三区| 国产麻豆日韩欧美久久| 99精品热视频| 欧美精选在线播放| 久久综合国产精品| 中文字幕欧美国产| 亚洲精品自拍动漫在线| 日韩avvvv在线播放| 久久99精品久久久久久| 成人在线视频首页| 欧美视频一区二区三区在线观看 | 日韩美女在线视频| 久久精品欧美一区二区三区麻豆| 综合婷婷亚洲小说| 日本成人在线不卡视频| 国产黄色精品网站| 日本精品裸体写真集在线观看| 88在线观看91蜜桃国自产| 久久久影院官网| 亚洲一区二区在线免费看| 极品少妇xxxx精品少妇偷拍| 91美女片黄在线观看91美女| 69堂国产成人免费视频|