/**
Flashattrib. Java
*/
Package picattrib;
Import java. Io. ioexception;
Import java. Io. fileinputstream;
Public class flashattrib {
Public flashattrib (){
}
Public static void main (string [] ARGs ){
Flashattrib = new flashattrib ();
Byte [] BB = NULL;
Image1 im = NULL;
Try {
BB = flashattrib. readfromfile ("D: // aa.swf ");
Im = flashattrib. getattrib (bb );
System. Out. println (IM. getwidth ());
System. Out. println (IM. gethight ());
BB = flashattrib. readfromfile ("D: // bb.swf ");
Im = flashattrib. getattrib (bb );
System. Out. println (IM. getwidth ());
System. Out. println (IM. gethight ());
BB = flashattrib. readfromfile ("D: // bb.swf ");
Im = flashattrib. getattrib (bb );
System. Out. println (IM. getwidth ());
System. Out. println (IM. gethight ());
} Catch (ioexception ex1 ){
System. Out. println (ex1 );
}
System. Out. println (IM. getwidth ());
System. Out. println (IM. gethight ());
/*
Byte AA = 0;
For (INT I = 0; isystem. Out. println (flashattrib. getint (AA ++ ));
}
*/
}
/**
* @ Param BB byte []
* @ Param start int
* @ Param Leng int
* @ Return int
*/
Public int getweizhi (INT start, int Weizhi, int Leng, byte [] bb ){
Int AA = 0;
If (Weizhi = 0 ){
AA = getint (BB [start]);
For (INT I = 1; I AA * = 256;
Int cc = getint (BB [start + I]);
AA + = cc;
}
} Else {
AA = getint (BB [start]) % 16;
AA * = 256;
AA + = getint (BB [start + 1]);
AA * = 16;
AA + = getint (BB [start + 2])/16;
}
Return AA;
}
Public image1 getattrib (byte [] bb ){
Image1 im = new image1 ();
// The width and height of the Flash file are not fixed. There are eight types of files. The specific width and height of the current FLASH file are determined based on the 9th-bit value.
// Hexadecimal values: 50, 58, 60, 68, 70, 78, 80, and 88
Switch (BB [8]) {
Case 80: Im. setwidth (getweizhi (9, 0, 2, BB)/10 );
Im. sethight (getweizhi (11,1, 2, BB)/10 );
Break;
Case 88: Im. setwidth (getweizhi (9, 1, 2, BB)/40 );
Im. sethight (getweizhi (12, 0, 2, BB)/10 );
Break;
Case 96: Im. setwidth (getweizhi (9, 1, 2, BB)/10 );
Im. sethight (getweizhi (12, 1, 2, BB)/10 );
Break;
Case 104: Im. setwidth (getweizhi (10, 0, 2, BB)/40 );
Im. sethight (getweizhi (13, 0, 2, BB)/10 );
Break;
Case 112: Im. setwidth (getweizhi (10, 0, 2, BB)/10 );
Im. sethight (getweizhi (13, 1, 2, BB)/10 );
Break;
Case 120: Im. setwidth (getweizhi (, 2, BB)/40 );
Im. sethight (getweizhi (14,0, 2, BB)/10 );
Break;
Case-128: Im. setwidth (getweizhi (, 2, BB)/10 );
Im. sethight (getweizhi (14,1, 2, BB)/10 );
Break;
Case-120: Im. setwidth (getweizhi (10, 0, 3, BB)/40 );
Im. sethight (getweizhi (15, 0, 2, BB)/10 );
Break;
}
Return im;
}
Public int getint (byte bb ){
If (BB> = 0) return BB;
Else return 256 + BB;
}
Private Static byte [] readfromfile (string filename) throws ioexception
{
Picsmodel model = NULL;
Fileinputstream fin = new fileinputstream (filename );
Byte [] Buf = new byte [Fin. Available ()];
Fin. Read (BUF );
Fin. Close ();
Return Buf;
}
}
This article is transferred from
Http://blog.csdn.net/zhangjianwxh/archive/2005/06/20/398385.aspx