package com.whyc.abe;
|
|
import java.io.FileInputStream;
|
import java.io.IOException;
|
|
public class ABEDataType {
|
|
public int typeTag0;
|
public int typeTag1;
|
public int typeTag2;
|
public int typeTag3;
|
|
public int checkDataHead(FileInputStream fis)
|
{
|
boolean file_end = false;
|
byte type_tag = 0;
|
byte[] tag = new byte[1];
|
try {
|
while(true)
|
{
|
type_tag = 0;
|
int n = 0;
|
for(n=0; n<4; n++)
|
{
|
if(1 != fis.read(tag, 0, 1))
|
{
|
file_end = true;
|
break;
|
}
|
if((0xFD != (tag[0]&0xFF)) && (0xFC != (tag[0]&0xFF)) && (0xFB != (tag[0]&0xFF)))
|
{
|
break;
|
}
|
}
|
|
if(n >= 4)
|
{
|
type_tag = tag[0];
|
break;
|
}
|
if(true == file_end)
|
{
|
type_tag = 1;
|
break;
|
}
|
}
|
} catch (IOException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
}
|
setType(type_tag&0xFF);
|
|
return (typeTag0);
|
}
|
|
public void setType(int type)
|
{
|
typeTag0 = type;
|
typeTag1 = type;
|
typeTag2 = type;
|
typeTag3 = type;
|
}
|
|
}
|