package com.dev.ntm.data.fbo;
|
|
import java.io.FileInputStream;
|
import java.io.IOException;
|
|
public class FboDataType {
|
public int TypeTag0;
|
public int TypeTag1;
|
public int TypeTag2;
|
public int TypeTag3;
|
|
public void setType(int type)
|
{
|
TypeTag0 = type;
|
TypeTag1 = type;
|
TypeTag2 = type;
|
TypeTag3 = type;
|
}
|
|
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)))
|
{
|
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);
|
}
|
}
|