lyh
7 小时以前 7126eab629d31beb5164b576a44b865a6a00f07c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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");
        }
    }
}