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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? outstream.java

?? java版本的flash文件(swf)播放器
?? JAVA
字號:
/****************************************************************
 * Copyright (c) 2001, David N. Main, All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or
 * without modification, are permitted provided that the 
 * following conditions are met:
 *
 * 1. Redistributions of source code must retain the above 
 * copyright notice, this list of conditions and the following 
 * disclaimer. 
 * 
 * 2. Redistributions in binary form must reproduce the above 
 * copyright notice, this list of conditions and the following 
 * disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * 3. The name of the author may not be used to endorse or 
 * promote products derived from this software without specific 
 * prior written permission. 
 * 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ****************************************************************/
package com.anotherbigidea.io;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;

/**
 * Output Stream Wrapper
 */
public class OutStream extends OutputStreamWrapper
{
	//--Bit buffer..
	private int mBitBuf;
	private int mBitPos;
    
	public OutStream( OutputStream out )
	{
		super( out );
        
		initBits();
	}

	protected OutStream() {
		super(null);
	}

	/**
	 * Write a signed value to the output stream in the given number of bits.
	 * The value must actually fit in that number of bits or it will be garbled
	 */
	public void writeSBits( int numBits, int value ) throws IOException 
	{
		//--Mask out any sign bit
		long lval = value & 0x7FFFFFFF;
        
		if( value < 0 ) //add the sign bit
		{
			lval |= 1L << (numBits-1);
		}
        
		//--Write the bits as if unsigned
		writeUBits( numBits, lval );
	}
    
	public void flush() throws IOException
	{
		flushBits();
		super.flush();
	}
    
	/**
	 * Compress all subsequent data
	 */
	public void writeCompressed() {
		setOutputStream( new DeflaterOutputStream( getOutputStream(), 
						 new Deflater( Deflater.BEST_COMPRESSION )));
	}
    
	/**
	 * Flush the bit buffer to the output stream and reset values
	 */
	public void flushBits() throws IOException
	{
		if( mBitPos == 0 ) return;  //nothing to flush
        
		super.write( mBitBuf );
		mBitBuf = 0;
		mBitPos = 0;
	}
    
	/**
	 * Write an unsigned value to the output stream in the given number of bits
	 */
	public void writeUBits( int numBits, long value ) throws IOException 
	{   
		if( numBits == 0 ) return;
        
		if( mBitPos == 0 ) mBitPos = 8;  //bitBuf was empty
        
		int bitNum = numBits;
        
		while( bitNum > 0 )  //write all bits
		{
			while( mBitPos > 0 && bitNum > 0 ) //write into all position of the bit buffer
			{
				if( getBit( bitNum, value ) ) mBitBuf = setBit( mBitPos, mBitBuf );
                
				bitNum--;
				mBitPos--;
			}
            
			if( mBitPos == 0 ) //bit buffer is full - write it
			{
				writeUI8( mBitBuf );
				mBitBuf = 0;
				if( bitNum > 0 ) mBitPos = 8; //prepare for more bits
			}
		}
	}
        
    
	/**
	 * Get the given bit (where lowest bit is numbered 1)
	 */
	public static boolean getBit( int bitNum, long value )
	{
		return (value & (1L << (bitNum - 1))) != 0;
	}
    
	/**
	 * Set the given bit (where lowest bit is numbered 1)
	 */    
	public static int setBit( int bitNum, int value )
	{
		return value | ( 1 << (bitNum-1) );
	}    
    
	/**
	 * Write the given bytes to the output stream
	 */
	public void write( byte[] bytes ) throws IOException
	{
		flushBits();
        
		if( bytes != null && bytes.length > 0 )
		{
			super.write( bytes );
		}
	}

	/**
	 * Write the given bytes to the output stream
	 */
	public void write( byte[] bytes, int start, int length ) throws IOException
	{
		flushBits();
        
		if( bytes != null && length > 0 )
		{
			super.write( bytes, start, length );
		}
	}    
    
	/**
	 * Write an 8 bit unsigned value to the out stream
	 */
	public void writeUI8( int value ) throws IOException
	{
		flushBits();
        
		super.write( value  );
	}  
    
	/**
	 * Write a 16 bit unsigned value to the out stream
	 */
	public void writeUI16( int value ) throws IOException
	{
		flushBits();
        
		super.write( value & 0xff );
		super.write( value >> 8   );
	}

	/**
	 * Write a 16 bit signed value to the out stream
	 */
	public void writeSI16( short value ) throws IOException
	{
		flushBits();
        
		super.write( value & 0xff );
		super.write( value >> 8 );
	}
    
    
	/**
	 * Write a 32 bit unsigned value to the out stream
	 */
	public void writeUI32( long value ) throws IOException
	{
		flushBits();
        
		super.write( (int)( value & 0xff ) );
		super.write( (int)( value >>  8  ) );
		super.write( (int)( value >> 16  ) );
		super.write( (int)( value >> 24  ) );
	}  
    
	/**
	 * Write a string to the output stream using the default encoding and add terminating null
	 */
	public void writeString( String s, String encoding ) throws IOException 
	{
		if( s == null ) s = "";
		writeString( s.getBytes( encoding ) );
	}
    
	/**
	 * Write a string to the output stream and add terminating null
	 */
	public void writeString( byte[] string ) throws IOException 
	{
		flushBits();
        
		if( string != null ) super.write( string );
		super.write( 0 );  //terminate string
	}   
    
	/**
	 * Calculate the byte length of a string as it would be written to the
	 * output stream
	 */
	public static int getStringLength( byte[] string )
	{
		if( string == null ) return 1;
		return string.length + 1; //to include the terminating null
	}

	/**
	 * Calculate the byte length of a string as it would be written to the
	 * output stream using the default character encoding
	 */
	public static int getStringLength( String string )
	{
		if( string == null ) return 1;
		byte[] bytes = string.getBytes();
        
		return bytes.length + 1; //to include the terminating null
	}    
    
	/**
	 * Reset the bit buffer
	 */
	private void initBits()
	{
		mBitBuf = 0;
		mBitPos = 0;
	}
    
	/**
	 * Determine the minimum number of bits required to hold the given
	 * signed value
	 */
	public static int determineSignedBitSize( int value )
	{
		if( value >= 0 ) return determineUnsignedBitSize( value ) + 1;
        
		//--This is probably a really bad way of doing this...
		int  topBit = 31;
		long mask = 0x40000000L;
        
		while( topBit > 0 )
		{
			if( (value & mask) == 0 ) break;
            
			mask >>= 1;
			topBit--;
		}
        
		if( topBit == 0 ) return 2;  //must have been -1
        
		//HACK: Flash represents -16 as 110000 rather than 10000 etc..
		int val2 = value & (( 1 << topBit) - 1 );
		if( val2 == 0 )
		{
			topBit++;
		}
        
		return topBit + 1;
	}

	/**
	 * Determine the minimum number of bits required to hold the given
	 * unsigned value (may be zero)
	 */
	public static int determineUnsignedBitSize( long value )
	{
		//--This is probably a really bad way of doing this...
		int  topBit = 32;
		long mask = 0x80000000L;
        
		while( topBit > 0 )
		{
			if( (value & mask) != 0 ) return topBit;
            
			mask >>= 1;
			topBit--;
		}
        
		return 0;
	}
    
	/**
	 * Write a float value
	 */
	public void writeFloat( float value ) throws IOException
	{
		writeSI32( Float.floatToIntBits( value ) );
	}
    
	/**
	 * Write a double value
	 */
	public void writeDouble( double value ) throws IOException
	{
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		DataOutputStream dout = new DataOutputStream( baos );
        
		dout.writeDouble( value );
        
		dout.flush();
        
		byte[] bytes = baos.toByteArray();
		byte[] bytes2 = new byte[8];
        
		bytes2[0] = bytes[3];
		bytes2[1] = bytes[2];
		bytes2[2] = bytes[1];
		bytes2[3] = bytes[0];
		bytes2[4] = bytes[7];
		bytes2[5] = bytes[6];
		bytes2[6] = bytes[5];
		bytes2[7] = bytes[4];        
        
		write( bytes2 );
	}
    
	/**
	 * Write a 32 bit signed value
	 */
	public void writeSI32( int value ) throws IOException 
	{
		flushBits();
        
		super.write( value & 0xff );
		super.write( value >> 8 );
		super.write( value >> 16 );
		super.write( value >> 24 );
	}
    
	/**
	 * Util to convert a signed int to 2 bytes
	 */
	public static byte[] sintTo2Bytes( int value )
	{
		return new byte[]
		{
			uintToByte( value & 0xff ),
			uintToByte( value >> 8   )
		};
	}
    
	/**
	 * Util to convert an unsigned int to 2 bytes
	 */
	public static byte[] uintTo2Bytes( int value )
	{
		return new byte[]
		{
			uintToByte( value & 0xff ),
			uintToByte( value >> 8   )
		};
	}

	/**
	 * Util to convert an unsigned int to 4 bytes
	 */
	public static byte[] uintTo4Bytes( int value )
	{
		return new byte[]
		{
			uintToByte( value & 0xff ),
			uintToByte( value >> 8   ),
			uintToByte( value >> 16  ),
			uintToByte( value >> 24  )
		};
	}    
    
	/**
	 * Util to convert an unsigned int to an unsigned byte
	 */
	public static byte uintToByte( int value )
	{
		int lowbit = value & 1;
		value >>= 1;
        
		byte b = (byte)value;
		b <<= 1;
		b |= (byte)lowbit;
        
		return b;
	}  
    
	/**
	 * @see java.io.OutputStream#write(int)
	 */
	public void write( int b ) throws IOException {
		flushBits();
		super.write( b );
	}
	
	/**
	 * Override to ensure that bits are flushed
	 */
	public void close() throws IOException {
		flush();
		super.close();
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜久久久久久久久久一区二区| 99精品一区二区三区| 亚洲国产日韩精品| 亚洲人成网站色在线观看| 国产精品久久久久aaaa樱花| 国产精品入口麻豆原神| 欧美激情自拍偷拍| 亚洲欧美中日韩| 亚洲精品视频自拍| 亚洲一区二区三区美女| 石原莉奈在线亚洲三区| 奇米四色…亚洲| 国产乱一区二区| 不卡欧美aaaaa| 欧美午夜电影网| 欧美肥妇bbw| 精品理论电影在线观看| 国产网站一区二区| 中文字幕亚洲不卡| 亚洲成人av免费| 久久国产精品99精品国产| 国产不卡视频一区二区三区| av一区二区三区黑人| 欧美中文字幕一区| 日韩一区二区三区观看| 久久精品在线观看| 中文字幕一区二区三区四区不卡| 亚洲最新在线观看| 日韩vs国产vs欧美| 国产精品一级片在线观看| 成人av在线影院| 欧美日韩国产大片| 久久女同精品一区二区| 亚洲三级免费观看| 午夜不卡av免费| 国产精品亚洲第一区在线暖暖韩国| av不卡一区二区三区| 欧美日本国产一区| 日本一区二区三区dvd视频在线| 亚洲欧美成aⅴ人在线观看| 日韩电影在线看| 成人av资源网站| 欧美一区二区三区视频免费| 国产日韩成人精品| 日一区二区三区| 国产高清精品网站| 欧美日韩性生活| 国产欧美视频一区二区| 天天综合色天天| 成人网页在线观看| 欧美日本韩国一区二区三区视频| 久久久久久久久久久久久久久99| 亚洲午夜免费视频| 国产高清一区日本| 制服丝袜激情欧洲亚洲| 国产精品久久久久久一区二区三区| 视频一区二区三区中文字幕| 不卡一区二区三区四区| 精品久久久久久久久久久久久久久久久| 亚洲欧洲国产专区| 经典三级视频一区| 欧美精品在线观看播放| 中文字幕一区二区三区在线观看| 美腿丝袜在线亚洲一区| 欧美制服丝袜第一页| 中文字幕 久热精品 视频在线| 日日摸夜夜添夜夜添精品视频| 99久久er热在这里只有精品66| 精品捆绑美女sm三区| 一二三区精品福利视频| av在线这里只有精品| 国产亚洲短视频| 卡一卡二国产精品| 精品视频在线视频| 亚洲女人****多毛耸耸8| 国产精品一区久久久久| 欧美大度的电影原声| 亚洲成人中文在线| 在线看不卡av| 亚洲男人都懂的| 波多野结衣亚洲| 国产三级久久久| 精彩视频一区二区| 欧美大黄免费观看| 蜜桃免费网站一区二区三区| 欧美在线一二三| 亚洲综合一区二区精品导航| av激情综合网| 国产精品国产自产拍高清av| 国产伦精品一区二区三区免费迷 | 国产电影一区二区三区| 91麻豆精品国产自产在线| 亚洲一区精品在线| 色爱区综合激月婷婷| 自拍偷自拍亚洲精品播放| eeuss鲁片一区二区三区在线看| 国产亚洲一区二区三区| 国产一区二区日韩精品| 欧美成人一区二区三区在线观看| 日韩成人dvd| 欧美一级高清片在线观看| 日日夜夜精品免费视频| 欧美一区二区精品在线| 日本aⅴ免费视频一区二区三区| 欧美电影在线免费观看| 日韩电影免费一区| 日韩你懂的在线播放| 久久综合综合久久综合| 精品久久国产字幕高潮| 国产在线不卡一区| 国产夜色精品一区二区av| 福利一区在线观看| 中文字幕一区二区三区色视频| jizz一区二区| 一区二区三区免费看视频| 在线观看免费亚洲| 午夜激情一区二区三区| 日韩视频免费观看高清完整版| 美国十次综合导航| 久久精品免视看| 色综合色综合色综合| 亚洲一区二区三区在线| 日韩一二三区不卡| 国产一区999| 亚洲乱码国产乱码精品精的特点| 欧美亚日韩国产aⅴ精品中极品| 三级久久三级久久久| 久久久午夜精品理论片中文字幕| 国产69精品久久久久毛片| 亚洲另类春色校园小说| 欧美精品乱码久久久久久| 精品影视av免费| 中文字幕一区二区三区不卡| 欧美性大战久久久久久久蜜臀| 麻豆免费看一区二区三区| 国产午夜精品在线观看| 一本大道av伊人久久综合| 青青草精品视频| 中文字幕第一区| 欧美日韩精品电影| 国产伦精品一区二区三区在线观看| 亚洲欧美在线视频观看| 欧美一区二区三区喷汁尤物| 国产夫妻精品视频| 亚洲成人你懂的| 国产清纯白嫩初高生在线观看91| 欧美制服丝袜第一页| 国产毛片一区二区| 亚洲综合色噜噜狠狠| 亚洲精品一区二区三区99| 91麻豆免费视频| 久久精品99国产国产精| 亚洲欧美激情一区二区| 欧美成人一区二区三区 | 久久久五月婷婷| 色综合激情久久| 国产一区二区三区免费看| 一区二区三区鲁丝不卡| 久久综合久久综合久久综合| 欧美午夜一区二区三区| 成人午夜激情在线| 国产一区二三区好的| 亚洲欧洲av色图| 精品国产一区a| 欧美日韩在线播放一区| 国产成人av自拍| 美国av一区二区| 亚洲宅男天堂在线观看无病毒| 国产人久久人人人人爽| 日韩精品中文字幕一区二区三区 | 粉嫩av亚洲一区二区图片| 性做久久久久久久免费看| 国产精品久久久久影院色老大| 欧美一区二区三区公司| 欧美午夜宅男影院| 99re免费视频精品全部| 国产一区在线视频| 日本三级亚洲精品| 亚洲制服丝袜在线| 亚洲日本va在线观看| 国产偷国产偷亚洲高清人白洁| 日韩一区二区免费在线电影| 欧美在线一区二区| 日本国产一区二区| 成人av一区二区三区| 国产一区二区三区免费播放| 狂野欧美性猛交blacked| 日韩国产在线观看| 亚洲国产综合色| 亚洲制服丝袜av| 一区二区在线观看免费| 亚洲欧洲精品一区二区三区不卡| 久久久久久久久久久久久久久99 | 精品国产乱码久久久久久蜜臀| 欧美久久久一区| 欧美精品丝袜中出| 欧美性猛交一区二区三区精品| 在线观看视频欧美| 欧美视频一区二区| 欧美性大战久久|