package com.lxzn.base;
|
|
import com.lxzn.base.service.IDncPassLogService;
|
import com.lxzn.framework.domain.base.DncPassLog;
|
import com.lxzn.framework.utils.BCryptUtil;
|
import com.lxzn.framework.utils.date.DateUtil;
|
import org.junit.Test;
|
import org.junit.runner.RunWith;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
import java.io.File;
|
import java.io.FileInputStream;
|
import java.io.IOException;
|
|
/**
|
* @author clown
|
* * @date 2023/11/30
|
*/
|
@RunWith(SpringRunner.class)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
public class BasePassLogTest {
|
@Autowired
|
private IDncPassLogService dncPassLogService;
|
@Test
|
public void testEncode() {
|
DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE));
|
System.out.println(dncPassLog);
|
}
|
|
/* public void isNCFile(String filePath) {
|
try {
|
NetcdfFile ncfile = NetcdfFiles.open(filePath);
|
boolean isNC = ncfile.isValidFile();
|
ncfile.close();
|
|
} catch (IOException ioe) {
|
// Handle exception if necessary
|
|
}
|
}*/
|
|
@Test
|
public void getFileSystemFormat() {
|
String filePath = "F:\\360MoveData\\Users\\Administrator\\Desktop\\0069.MPF";
|
File file = new File(filePath);
|
if (!file.exists()) {
|
System.out.println("文件不在,路径:" + filePath);
|
}
|
try (FileInputStream in = new FileInputStream(filePath)) {
|
StringBuffer systemFormat = new StringBuffer();
|
int count;
|
int i = 0;
|
while ((count = in.read()) != -1) {
|
//CR: ASCII: 13
|
if (count == 13) {
|
systemFormat.append(count);
|
i++;
|
}
|
//LF: ASCII: 10
|
if (count == 10) {
|
systemFormat.append(count);
|
i++;
|
}
|
if (i == 2) break;
|
}
|
if (systemFormat.toString().contains("1313")) {
|
System.out.println("Mac");
|
|
}
|
if (systemFormat.toString().contains("1310")) {
|
|
}
|
if (systemFormat.toString().contains("1010")) {
|
System.out.println("Unix");
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
System.out.println("Exception e");
|
}
|
}
|
}
|