|
@@ -352,37 +352,25 @@ public class CreateObjUtil {
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
|
- convertDamToTxt("D:\\test\\01c0889ce8f34afc885fafdc94bec106_50k.dam", "D:\\test\\modeldata.txt");
|
|
|
|
|
|
+ convertVisionmodeldataToTxt("D:\\test\\test\\vision.modeldata", "D:\\test\\test\\vision.txt");
|
|
|
|
+ FileUtil.del("D:\\test\\test");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception
|
|
|
|
- {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- File file = new File(srcpath);
|
|
|
|
- FileInputStream fis=new FileInputStream(file);
|
|
|
|
-
|
|
|
|
|
|
+ public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception {
|
|
|
|
+ try (FileInputStream fis = new FileInputStream(srcpath)){
|
|
Visionmodeldata.NavigationInfo data_NavigationInfo = Visionmodeldata.NavigationInfo.parseFrom(fis);
|
|
Visionmodeldata.NavigationInfo data_NavigationInfo = Visionmodeldata.NavigationInfo.parseFrom(fis);
|
|
-
|
|
|
|
- //PrintStream out = new PrintStream(despath);
|
|
|
|
String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
|
|
String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
|
|
- ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
|
|
|
|
- BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
|
|
|
|
- BufferedInputStream bis = new BufferedInputStream(stream);
|
|
|
|
- int b = -1;
|
|
|
|
- while ((b = bis.read()) != -1) {
|
|
|
|
- bos.write(b);
|
|
|
|
- }
|
|
|
|
- //out.close();
|
|
|
|
- bis.close();
|
|
|
|
- bos.close();
|
|
|
|
- }
|
|
|
|
- catch(Exception e)
|
|
|
|
- {
|
|
|
|
- StringWriter trace=new StringWriter();
|
|
|
|
- e.printStackTrace(new PrintWriter(trace));
|
|
|
|
- log.error(trace.toString());
|
|
|
|
|
|
+ try (
|
|
|
|
+ ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
|
|
|
|
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
|
|
|
|
+ BufferedInputStream bis = new BufferedInputStream(stream)
|
|
|
|
+ ){
|
|
|
|
+ int b = -1;
|
|
|
|
+ while ((b = bis.read()) != -1) {
|
|
|
|
+ bos.write(b);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|