Skip to content

Commit b9be175

Browse files
author
顾汉杰
committed
add some java common utils
1 parent 1869b13 commit b9be175

28 files changed

+8340
-0
lines changed

Base64.java

Lines changed: 1541 additions & 0 deletions
Large diffs are not rendered by default.

Base64DecodingException.java

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package com.gootrip.util;
2+
3+
/*
4+
* Base64 decoding exception.
5+
* Copyright (C) 2002 Stephen Ostermiller
6+
* http://ostermiller.org/contact.pl?regarding=Java+Utilities
7+
*
8+
* This program is free software; you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation; either version 2 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* See COPYING.TXT for details.
19+
*/
20+
21+
import java.io.*;
22+
23+
/**
24+
* Exception that is thrown when an unexpected character is encountered
25+
* during Base64 decoding. One could catch this exception and use
26+
* the unexpected character for some other purpose such as including it
27+
* with data that comes at the end of a Base64 encoded section of an email
28+
* message.
29+
*
30+
* @author Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities
31+
* @since ostermillerutils 1.00.00
32+
*/
33+
public class Base64DecodingException extends IOException {
34+
private char c;
35+
36+
/**
37+
* Construct an new exception.
38+
*
39+
* @param message message later to be returned by a getMessage() call.
40+
* @param c character that caused this error.
41+
*
42+
* @since ostermillerutils 1.00.00
43+
*/
44+
public Base64DecodingException(String message, char c){
45+
super(message);
46+
this.c = c;
47+
}
48+
49+
/**
50+
* Get the character that caused this error.
51+
*
52+
* @return the character that caused this error.
53+
*
54+
* @since ostermillerutils 1.00.00
55+
*/
56+
public char getChar(){
57+
return c;
58+
}
59+
}

CConst.java

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.gootrip.util;
2+
3+
public class CConst {
4+
5+
/**
6+
* 网站图片目录
7+
*/
8+
public final static String PIC_ROOT = "/pic/";
9+
10+
/**
11+
* 网站软件目录
12+
*/
13+
14+
public final static String SOFT_ROOT = "/soft/";
15+
16+
/**
17+
* 附件文件存放的绝对路径
18+
*/
19+
20+
public final static String ATTACH_ROOT = "/attach/";
21+
22+
/**
23+
* 动态程序路径
24+
*/
25+
26+
public final static String ProgramPath = "/programs/";
27+
28+
29+
/**
30+
* 上传图片大小限制,单位byte
31+
*/
32+
public final static long MAX_UPLOAD_PIC_SIZE = 1000 * 1024 * 4;
33+
/**
34+
* 上传文件大小限制,单位byte
35+
*/
36+
public final static long MAX_UPLOAD_FILE_SIZE = 10 * 1024 * 1024 * 8;
37+
38+
/**
39+
* 上传软件大小限制,单位byte
40+
*/
41+
public final static long MAX_UPLOAD_SOFT_SIZE = 100 * 1024 * 1024 * 8;
42+
43+
/**
44+
* 错误登录次数最多3次
45+
*/
46+
public final static int MAX_LOGIN_TIMES = 3;
47+
/**
48+
* 错误登录3次后用户被锁10分钟
49+
*/
50+
public final static int LOCK_TIME = +10;
51+
52+
public final static String[] ADMIN = {"admin", "longlob"};
53+
54+
}

0 commit comments

Comments
 (0)