feat: 从油色谱图文件读取解析成java结构
parent
d4c39f0ac4
commit
594271831d
@ -1,13 +1,34 @@
|
|||||||
package com.xydl.cac.spectrogram;
|
package com.xydl.cac.spectrogram;
|
||||||
|
|
||||||
|
import com.xydl.cac.model.spectrogram.YspModel;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ProcessorYsp {
|
public class ProcessorYsp {
|
||||||
|
|
||||||
public void process(String localFilePath) {
|
public YspModel process(String localFilePath) {
|
||||||
|
try (DataInputStream dis = new DataInputStream(new FileInputStream(localFilePath))) {
|
||||||
|
YspModel model = this.readOneBlock(dis);
|
||||||
|
return model;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private YspModel readOneBlock(DataInputStream dis) throws Exception {
|
||||||
|
YspModel model = new YspModel();
|
||||||
|
model.readFrom(dis);
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ProcessorYsp processorYsp = new ProcessorYsp();
|
||||||
|
processorYsp.process("C:/Code/cac/谱图文件/0312B12000042A3840001_203_07_20250113163055.dat");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue