|
@@ -1,7 +1,7 @@
|
|
package com.fdkankan.common.util;
|
|
package com.fdkankan.common.util;
|
|
|
|
|
|
-import cn.hutool.core.exceptions.ExceptionUtil;
|
|
|
|
-import cn.hutool.core.io.FileTypeUtil;
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
|
+import cn.hutool.core.util.ZipUtil;
|
|
import com.fdkankan.common.constant.ConstantFileName;
|
|
import com.fdkankan.common.constant.ConstantFileName;
|
|
import com.fdkankan.common.constant.ConstantFilePath;
|
|
import com.fdkankan.common.constant.ConstantFilePath;
|
|
import com.fdkankan.common.proto.BigSceneProto;
|
|
import com.fdkankan.common.proto.BigSceneProto;
|
|
@@ -9,18 +9,7 @@ import com.fdkankan.common.proto.Common;
|
|
import com.fdkankan.common.proto.Visionmodeldata;
|
|
import com.fdkankan.common.proto.Visionmodeldata;
|
|
import com.fdkankan.common.proto.format.JsonFormat;
|
|
import com.fdkankan.common.proto.format.JsonFormat;
|
|
import com.google.protobuf.TextFormat;
|
|
import com.google.protobuf.TextFormat;
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.Base64;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.concurrent.Callable;
|
|
|
|
-import java.util.concurrent.CountDownLatch;
|
|
|
|
-import java.util.concurrent.ExecutorService;
|
|
|
|
-import java.util.concurrent.Executors;
|
|
|
|
-import java.util.concurrent.Future;
|
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.slf4j.Logger;
|
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.util.StopWatch;
|
|
import org.springframework.util.StopWatch;
|
|
|
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
@@ -268,24 +257,29 @@ public class CreateObjUtil {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public static void convertTxtToDam(String srcpath,String despath)throws Exception
|
|
|
|
- {
|
|
|
|
- BigSceneProto.binary_mesh.Builder builder= BigSceneProto.binary_mesh.newBuilder();
|
|
|
|
- InputStream inputStream = new FileInputStream(srcpath);
|
|
|
|
- InputStreamReader reader = new InputStreamReader(inputStream, "ASCII");
|
|
|
|
- TextFormat.merge(reader, builder);
|
|
|
|
- byte[] buf= builder.build().toByteArray();
|
|
|
|
-
|
|
|
|
- //把序列化后的数据写入本地磁盘
|
|
|
|
- ByteArrayInputStream stream = new ByteArrayInputStream(buf);
|
|
|
|
- BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
|
|
|
|
- BufferedInputStream bis = new BufferedInputStream(stream);
|
|
|
|
- int b = -1;
|
|
|
|
- while ((b = bis.read()) != -1) {
|
|
|
|
- bos.write(b);
|
|
|
|
- }
|
|
|
|
- bis.close();
|
|
|
|
- bos.close();
|
|
|
|
|
|
+ public static void convertTxtToDam(String srcpath,String despath)throws Exception{
|
|
|
|
+ BigSceneProto.binary_mesh.Builder builder = BigSceneProto.binary_mesh.newBuilder();
|
|
|
|
+ InputStream inputStream = new FileInputStream(srcpath);
|
|
|
|
+ InputStreamReader reader = new InputStreamReader(inputStream, "ASCII");
|
|
|
|
+ TextFormat.merge(reader, builder);
|
|
|
|
+ byte[] buf = builder.build().toByteArray();
|
|
|
|
+
|
|
|
|
+ //把序列化后的数据写入本地磁盘
|
|
|
|
+ ByteArrayInputStream stream = new ByteArrayInputStream(buf);
|
|
|
|
+ BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
|
|
|
|
+ BufferedInputStream bis = new BufferedInputStream(stream);
|
|
|
|
+ int b = -1;
|
|
|
|
+ while ((b = bis.read()) != -1) {
|
|
|
|
+ bos.write(b);
|
|
|
|
+ }
|
|
|
|
+ bis.close();
|
|
|
|
+ bos.close();
|
|
|
|
+
|
|
|
|
+ // gzip压缩
|
|
|
|
+ cn.hutool.core.io.FileUtil.writeBytes(ZipUtil.gzip(new File(despath)),despath + ".gzip");
|
|
|
|
+
|
|
|
|
+ // 重命名
|
|
|
|
+ FileUtil.rename(new File(despath + ".gzip"), despath, true);
|
|
}
|
|
}
|
|
|
|
|
|
public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception
|
|
public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception
|