总结0423

1.ftp相关操作

1
2
3
4
5
6
7
8
9
10
ftpClient = new FTPClient();
ftpClient.connect(ftpHost); ftpClient.login(ftpUserName, ftpPassword); // 以二进制进行传输 ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE); // 用被动模式传输 ftpClient.enterLocalPassiveMode(); // 中文支持 ftpClient.setControlEncoding("UTF-8"); // 设置默认超时时间 ftpClient.setDefaultTimeout(DEFAULT_TIMEOUT);
//上传文件
ftpClient.storeFile(String remote, InputStream local);
//切换工作路径(操作之前需要切换)
ftpClient.changeWorkingDirectory(String pathname)
//获取文件流
ftpClient.retrieveFileStream(String remote)
//创建路径
ftpClient.makeDirectory(String pathname);

2.jssdk

1
2
3
4
5
6
7
8
9
10
11
12
13
联系人是多个渠道账号合并出的一个人

自定义渠道连接:
获取jssdk代码,插入head中:
1.系统事件统计:sdk会自动统计pv事件
2.可以创建动态组:比如用户范围跟网页
创建事件分析,同动态组
3.识别联系人,需要实现相关的js代码:
window.LFAPP.identify({});
4.新增自定义事件:先创建自定义事件,然后代码中写入js:
window.linkflow.sendEvent({});

私有App,获取App Key和App Secret,然后获取Access Token来访问open api 得到Linkflow的资源

3.gzip和zip转化

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
//解压gzip
public static final byte[] unGzip(byte[] data) throws IOException {
GZIPInputStream zin = new GZIPInputStream(new ByteArrayInputStream(data));
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
data = new byte[10240];
int len;
while ((len = zin.read(data)) != -1) {
out.write(data, 0, len);
}
return out.toByteArray();
} finally {
zin.close();
out.close();
}
}

//解压zip
public static final byte[] unzip(byte[] data) throws IOException {
byte[] b = null;
try {
ByteArrayInputStream bis = new ByteArrayInputStream(data);
ZipInputStream zip = new ZipInputStream(bis);
while (zip.getNextEntry() != null) {
byte[] buf = new byte[1024];
int num = -1;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while ((num = zip.read(buf, 0, buf.length)) != -1) {
baos.write(buf, 0, num);
}
b = baos.toByteArray();
baos.flush();
baos.close();
}
zip.close();
bis.close();
} catch (Exception ex) {
ex.printStackTrace();
}
return b; }

//压缩为gzip
public static final byte[] gzip(byte[] data) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
GZIPOutputStream zout = new GZIPOutputStream(out);
zout.write(data);
zout.close();
return out.toByteArray(); }