From bcd7202db10b9dc9600660230b0d8b39b6c68c6c Mon Sep 17 00:00:00 2001 From: lxw <810412026@qq.com> Date: 星期五, 10 二月 2023 10:53:43 +0800 Subject: [PATCH] 修改 --- src/main/java/com/whyc/fbo/FboDataInf.java | 76 ++----------------------------------- 1 files changed, 5 insertions(+), 71 deletions(-) diff --git a/src/main/java/com/whyc/fbo/FboDataInf.java b/src/main/java/com/whyc/fbo/FboDataInf.java index df7913c..cf7955f 100644 --- a/src/main/java/com/whyc/fbo/FboDataInf.java +++ b/src/main/java/com/whyc/fbo/FboDataInf.java @@ -1,87 +1,21 @@ package com.whyc.fbo; -import lombok.extern.slf4j.Slf4j; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; +import lombok.Data; + import java.util.ArrayList; import java.util.List; - -@Slf4j +@Data public class FboDataInf { - public static final int DataType_Dis = 0xFD; //鏀剧數 - public static final int DataType_Char = 0xFC; //鍏呯數 - public static final int DataType_Peac = 0xFB; //甯歌 - - + public List<FboData> fboData; public FboDataHeadStart fboDataStart; public FboDataHeadStop fboDataStop; - + public FboDataInf() { fboData = new ArrayList<FboData>(); fboDataStart = new FboDataHeadStart(); fboDataStop = new FboDataHeadStop(); } - public void readFboFile(String filePath) - { - - FileInputStream fis = null; - try { - File f = new File(filePath); - if(!f.exists()) { - System.out.println("鏂囦欢涓嶅瓨鍦�.........."); - } - fis = new FileInputStream(f); - byte[] buf = new byte[256]; - if(fis.read(buf, 0, buf.length) == 256) - { - this.fboDataStart.setDataInf(buf,this.fboDataStop); - FboData.DataType mType = new FboData().new DataType(); - - while(true) - { - int tag = mType.checkDataHead(fis); - if((0xFD == tag) || (0xFC == tag) || (0xFB == tag)) - { - byte[] databuf = new byte[this.fboDataStart.BattGroup*14 + 40]; - if(fis.read(databuf) == databuf.length) - { - FboData m_FboData = new FboData(this.fboDataStart.BattGroup); - m_FboData.m_DataType = mType.clone(); - m_FboData.setData(databuf); - fboData.add(m_FboData); - } - } - if(tag == 1) - break; - } - } - - } catch (IOException e) { - e.printStackTrace(); - //log.error(e.toString()); - } finally { - if(null != fis) - { - try { - fis.close(); - } catch (IOException e) { - e.printStackTrace(); - //log.error(e.toString()); - } - } - } - } - - - public static void main(String[] args) { - FboDataInf fbo = new FboDataInf(); - //fbo.readFboFile("D:/test/F2022-03-09 11.26.12.FBX"); - //fbo.readFboFile("D:/test/F2022-03-09 16.22.37.FBX"); - //fbo.readFboFile("D:/test/F2022-03-10 11.12.30.FBX"); - fbo.readFboFile("C:\\Users\\Administrator\\Desktop\\F2022-05-09 10.45.12.FBX"); - } } -- Gitblit v1.9.1