JML

net.sf.jqql
Class Util

java.lang.Object
  extended by net.sf.jqql.Util

public class Util
extends Object

Tools, convenient way to provide some, some are mainly for debugging purposes, some not 工具类,提供一些方便的方法,有些主要是用于调试用途,有些不是

Author:
luma, notXX

Field Summary
static int MASK_VALID
          Valid character mask.
 
Constructor Summary
Util()
           
 
Method Summary
static boolean checkFileMD5(RandomAccessFile file, byte[] md5)
          检查收到的文件MD5是否正确
static boolean checkFileMD5(String filename, byte[] md5)
          check the MD5 file which received whether is correct 检查收到的文件MD5是否正确
static boolean compareMD5(byte[] m1, byte[] m2)
          compare two MD5 whether is equal 比较两个MD5是否相等
static String convertByteToHexString(byte[] b)
          a Hex string band into a byte array 把字节数组转换成16进制字符串
static String convertByteToHexString(byte[] b, int offset, int len)
          a Hex string band into a byte array 把字节数组转换成16进制字符串
static String convertByteToHexStringWithoutSpace(byte[] b)
          a Hex string band into a byte array 把字节数组转换成16进制字符串
static String convertByteToHexStringWithoutSpace(byte[] b, int offset, int len)
          a Hex string band into a byte array 把字节数组转换成16进制字符串
static byte[] convertCharToBytes(char c)
          a char change to byte-Array 把一个char转换成字节数组
static byte[] convertHexStringToByte(String s)
          a Hex string band into a byte array 转换16进制字符串为字节数组
static byte[] convertHexStringToByteNoSpace(String s)
          a Hex string band into a byte array, string no spaces,so every ocharacters is two-byte 把一个16进制字符串转换为字节数组,字符串没有空格,所以每两个字符 一个字节
static String convertIpToString(byte[] ip)
          use the byte-array of ip conversion String from 把ip的字节数组形式转换成字符串形式
static String filterUnprintableCharacter(String s)
          Filter in strings of characters can not print
static int findByteOffset(byte[] ar, byte b)
          start from indicate location to search the location where a char appear 从头开始(包含指定位置)查找一个字节的出现位置
static int findByteOffset(byte[] ar, byte b, int from)
          start from indicate location to search the location where a char appear 从指定位置开始(包含指定位置)查找一个字节的出现位置
static int findByteOffset(byte[] ar, byte b, int from, int occurs)
          start from indicate location to search the location where next char appear the N th times 从指定位置开始(包含指定位置)查找一个字节的第N次出现位置
static String get05CommandString(char command)
           
static String getAuthActionString(byte b)
          get the String form of authenticate type 得到认证操作字符串形式
static String getAuthTypeString(byte b)
          get the String form of authenticate type 得到认证类型字符串形式
static byte getByte(String s, int faultValue)
          String convert to byte 把字符串转换成byte
static byte[] getBytes(String s)
          according to the encoding form to get the byte array format of String 根据缺省编码得到字符串的字节数组形式
static byte[] getBytes(String s, String encoding)
          according to the encoding form to get the byte array format of String
static char getChar(String s, int faultValue)
          convert String to unsigned number of char 把字符串转换成char类型的无符号数
static String getClusterCommandString(byte cmd)
          get the String form of cluster operate,just for test 得到群操作的字符串形式,仅用于调试
static String getCommandString(char cmd)
           
static String getEncodingString(char encoding)
          this is not for test ,we acture wanna invoke the method 这个不是用于调试的,真正要用的方法
static String getErrorString(int error)
          get the type of error 得到错误类型
static String getFileCommandString(char command)
          return String form of file command,just for test 返回文件命令的字符串形式,仅用作调试
static byte[] getFileMD5(RandomAccessFile file)
          calculate the MD5 of file , just calculate in front of up to 10,002,432 bytes 计算文件的MD5,最多只计算前面10002432字节
static byte[] getFileMD5(String filename)
          calculate the MD5 of file , just calculate in front of up to 10,002,432 bytes 计算文件的MD5,最多只计算前面10002432字节
static String getFileMD5String(String filename)
          get the String form of MD5 file
static String getFTPCommandString(char command)
           
static String getIMReplyType(byte type)
          return response type of String form ,just for test 返回字符串形式的回复类型,仅用于调试
static int getInt(String s, int faultValue)
          convert the String to int 把字符串转换成int
static int getInt(String s, int radix, int faultValue)
          convert the String to int 把字符串转换成int
static int getIntFromBytes(byte[] b, int offset, int len)
          From the array of bytes from the designated location of the len bytes into int type (big-endian), if less than 4 bytes, that is high 0 从字节数组的指定位置起的len的字节转换成int型(big-endian),如果不足4字节,高位认为是0
static byte[] getIpByteArrayFromString(String ip)
          get byte-array form form String of IP 从ip的字符串形式得到字节数组形式
static String getIpStringFromBytes(byte[] ip)
          get String form form byte-array of IP
static long getLong(String s, int radix, long faultValue)
          convert String to long 把字符串转换成long
static String getNormalIMTypeString(char type)
          return general type in the message, just for test 返回普通消息中的类型,仅用作调试
static String getProtocolString(int p)
          get the string of protocol,for debug 得到协议的字符串,for debug
static String getSearchTypeString(byte b)
          get the string of search type 得到搜索类型的字符串
static String getString(byte[] b)
          According to default encoding convert byte-array to String 根据缺省编码将字节数组转换成字符串
static String getString(byte[] b, int offset, int len)
          According default encoding convert byte-array to String 根据缺省编码方式将字节数组转换成字符串
static String getString(byte[] b, int offset, int len, String encoding)
          According to the encoding convert byte-array to String 根据某种编码方式将字节数组转换成字符串
static String getString(byte[] b, String encoding)
          According to the encoding convert byte-array to String 根据某种编码方式将字节数组转换成字符串
static String getString(ByteBuffer buf)
          resolve a string from the current location of Buf,stop until a run separator, or reach the end of the buf 从buf的当前位置解析出一个字符串,直到碰到了buf的结尾
static String getString(ByteBuffer buf, byte delimit)
          resolve a string from the current location of Buf, stop until a run separator, or reach the end of the buf
static String getString(ByteBuffer buf, byte delimit, int maxLen)
          resolve a string from the current location of Buf,stop until reach delimit or have readed maxlen number of bytes or reach the end.
static String getString(ByteBuffer buf, int len)
          resolve a string from the current location of Buf, stop until reach the end of the buf or read len number bytes 从buf的当前位置解析出一个字符串,直到碰到了buf的结尾或者读取了len个byte之后停止
static String getString(String s, String srcEncoding, String destEncoding)
          encoding conversion the source String ,if fail ,return the String
static byte[] getSubBytes(byte[] b, int offset, int len)
          get the apart of byte array 得到一个字节数组的一部分
static long getUnsignedInt(byte[] in, int offset, int len)
          The byte offset from the beginning of an array of len bytes into an unsigned int, there is no java as unsigned, so unsigned (Edited by notxx) changed the algorithm slightly better performance.
static int indexOf(byte[] buf, int begin, byte b)
          start begin positions where Buf byte in the array to find an byte-array in b as long as any of the emergence of the first location 在buf字节数组中的begin位置开始,查找字节b出现的第一个位置
static int indexOf(byte[] buf, int begin, byte[] b)
          start begin positions where Buf byte in the array to find an byte-array in b as long as any of the emergence of the first location 在buf字节数组中的begin位置开始,查找字节数组b中只要任何一个出现的第一个位置
static boolean isByteArrayEqual(byte[] b1, byte[] b2)
          Comparison of the two-byte array of content is the same
static boolean isInt(String s)
          check String whether is int format 检查字符串是否是整数格式
static boolean isIpEquals(byte[] ip1, byte[] ip2)
          estimate the ip whether is equal another ip 判断IP是否相等
static boolean isIpZero(byte[] ip)
          estimate the IP whether is full-0
static char parseChar(byte[] content, int offset)
          Content from the offset position from the 2-byte analysis into the char type 从content的offset位置起的2个字节解析成char类型
static int parseInt(byte[] content, int offset)
          Content from the offset position from the 4-byte analysis into the int type 从content的offset位置起的4个字节解析成int类型
static Random random()
          return a random object
static byte[] randomKey()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MASK_VALID

public static final int MASK_VALID
Valid character mask.

See Also:
Constant Field Values
Constructor Detail

Util

public Util()
Method Detail

getUnsignedInt

public static long getUnsignedInt(byte[] in,
                                  int offset,
                                  int len)
The byte offset from the beginning of an array of len bytes into an unsigned int, there is no java as unsigned, so unsigned (Edited by notxx) changed the algorithm slightly better performance. In my test machine 10,000 times the original cost algorithm 18s, the algorithm to spend 12s.

Parameters:
in - 字节数组.
offset - 从哪里开始转换.
len - 转换长度, 如果len超过8则忽略后面的
Returns:

filterUnprintableCharacter

public static String filterUnprintableCharacter(String s)
Filter in strings of characters can not print

Parameters:
s - 字符串
Returns:
过滤后的字符串

isByteArrayEqual

public static boolean isByteArrayEqual(byte[] b1,
                                       byte[] b2)
Comparison of the two-byte array of content is the same

Parameters:
b1 - 字节数组1
b2 - 字节数组2
Returns:
true表示相等

checkFileMD5

public static boolean checkFileMD5(RandomAccessFile file,
                                   byte[] md5)
检查收到的文件MD5是否正确

Parameters:
file - 收到的存在本地的文件
md5 - 正确的MD5
Returns:
true表示正确

isIpZero

public static boolean isIpZero(byte[] ip)
estimate the IP whether is full-0

Parameters:
ip -
ip -
Returns:
true indicate the IP is full-0 判断IP是否全0

checkFileMD5

public static boolean checkFileMD5(String filename,
                                   byte[] md5)
check the MD5 file which received whether is correct 检查收到的文件MD5是否正确

Parameters:
filename -
md5 -
Returns:

getFileMD5

public static byte[] getFileMD5(String filename)
calculate the MD5 of file , just calculate in front of up to 10,002,432 bytes 计算文件的MD5,最多只计算前面10002432字节

Parameters:
filename -
Returns:

getFileMD5

public static byte[] getFileMD5(RandomAccessFile file)
calculate the MD5 of file , just calculate in front of up to 10,002,432 bytes 计算文件的MD5,最多只计算前面10002432字节

Parameters:
file - RandomAccessFile对象
Returns:
MD5字节数组

getFileMD5String

public static String getFileMD5String(String filename)
get the String form of MD5 file

Parameters:
filename -
filename - 文件名
Returns:
String form of MD5, lower case if occur error , return null 得到一个文件的MD5字符串形式

compareMD5

public static boolean compareMD5(byte[] m1,
                                 byte[] m2)
compare two MD5 whether is equal 比较两个MD5是否相等

Parameters:
m1 -
m2 -
Returns:
true indicate they is equal

getBytes

public static byte[] getBytes(String s,
                              String encoding)
according to the encoding form to get the byte array format of String

Parameters:
s - String
encoding -
s - 字符串
encoding - 编码方式
Returns:
byte array of encoding form , if encoding not support , return a byte array which is default encoding 根据某种编码方式得到字符串的字节数组形式

getBytes

public static byte[] getBytes(String s)
according to the encoding form to get the byte array format of String 根据缺省编码得到字符串的字节数组形式

Parameters:
s -
Returns:

getString

public static String getString(String s,
                               String srcEncoding,
                               String destEncoding)
encoding conversion the source String ,if fail ,return the String

Parameters:
s - source String
srcEncoding - source encoding
destEncoding - dest encoding
s - 原始字符串
srcEncoding - 源编码方式
destEncoding - 目标编码方式
Returns:
String after conversion,if conversion fail,return source String 对原始字符串进行编码转换,如果失败,返回原始的字符串

getString

public static String getString(ByteBuffer buf,
                               byte delimit)
resolve a string from the current location of Buf, stop until a run separator, or reach the end of the buf

This method is not responsible for adjust position of buf , so be sure to call before buf current location at the beginning of a string. After read it complete ,the current position of buf will be located after the separator's

Return the string will use the default encoding of QQ, the general encoding is GBK

Parameters:
buf - ByteBuffer
delimit - split char
Returns:
String

getString

public static String getString(ByteBuffer buf)
resolve a string from the current location of Buf,stop until a run separator, or reach the end of the buf 从buf的当前位置解析出一个字符串,直到碰到了buf的结尾

This method is not responsible for adjust the position of buf,so be sure that current location of buf is at the beginning of a string before invoke it. After read it complete ,the current position of buf will be located after the separator's 此方法不负责调整buf位置,调用之前务必使buf当前位置处于字符串开头。在读取完成 后,buf当前位置将位于buf最后之后

Return the string will use the default encoding of QQ, the general encoding is GBK

Parameters:
buf - ByteBuffer
Returns:
String

getString

public static String getString(ByteBuffer buf,
                               int len)
resolve a string from the current location of Buf, stop until reach the end of the buf or read len number bytes 从buf的当前位置解析出一个字符串,直到碰到了buf的结尾或者读取了len个byte之后停止

this method is not responsible for adjust the position of buf,so be sure that current location of buf is at the beginning of a string before invoke it. After read it complete ,current position of buf will be located after len byte or after the last byte 此方法不负责调整buf位置,调用之前务必使buf当前位置处于字符串开头。在读取完成 后,buf当前位置将位于len字节之后或者最后之后

Return the string will use the default encoding of QQ, the general encoding is GBK

Parameters:
buf - ByteBuffer
Returns:
String

getString

public static String getString(ByteBuffer buf,
                               byte delimit,
                               int maxLen)
resolve a string from the current location of Buf,stop until reach delimit or have readed maxlen number of bytes or reach the end. 从buf的当前位置解析出一个字符串,直到碰到了delimit或者读取了maxLen个byte或者 碰到结尾之后停止

this method is not responsible for adjust the position of buf,so be sure that current location of buf is at the beginning of a string before invoke it. After read it complete ,current position of buf will be located after maxLen 此方法不负责调整buf位置,调用之前务必使buf当前位置处于字符串开头。在读取完成 后,buf当前位置将位于maxLen之后

Return the string will use the default encoding of QQ, the general encoding is GBK

Parameters:
buf - ByteBuffer
delimit - delimit
maxLen - max len to read
Returns:
String

getString

public static String getString(byte[] b,
                               String encoding)
According to the encoding convert byte-array to String 根据某种编码方式将字节数组转换成字符串

Parameters:
b - byte-array
encoding -
Returns:
if the encoding was not supported ,return the default encoding type

getString

public static String getString(byte[] b)
According to default encoding convert byte-array to String 根据缺省编码将字节数组转换成字符串

Parameters:
b - byte-array
Returns:
String

getString

public static String getString(byte[] b,
                               int offset,
                               int len,
                               String encoding)
According to the encoding convert byte-array to String 根据某种编码方式将字节数组转换成字符串

Parameters:
b - byte-array
offset - the posite where start to convert
len - the length which we wanna convert
encoding -
Returns:
if the encoding was not supported ,return the default encoding type

getString

public static String getString(byte[] b,
                               int offset,
                               int len)
According default encoding convert byte-array to String 根据缺省编码方式将字节数组转换成字符串

Parameters:
b - byte-array
offset - the posite where start to convert
len - the length which we wanna convert
Returns:

getInt

public static int getInt(String s,
                         int faultValue)
convert the String to int 把字符串转换成int

Parameters:
s - String
faultValue - if conversion is fail , return this value
Returns:
if conversion is fail , return faultValue,else return the value after converted

getLong

public static long getLong(String s,
                           int radix,
                           long faultValue)
convert String to long 把字符串转换成long

Parameters:
s - String
faultValue - if conversion is fail , return this value
Returns:
if conversion is fail , return faultValue,else return the value after converted

getInt

public static int getInt(String s,
                         int radix,
                         int faultValue)
convert the String to int 把字符串转换成int

Parameters:
s - String
radix - the radix 基数
faultValue - if conversion is fail , return this value
Returns:
if conversion is fail , return faultValue,else return the value after converted

isInt

public static boolean isInt(String s)
check String whether is int format 检查字符串是否是整数格式

Parameters:
s - String
Returns:
true indicate that String can convert to int type

getChar

public static char getChar(String s,
                           int faultValue)
convert String to unsigned number of char 把字符串转换成char类型的无符号数

Parameters:
s - String
faultValue - if conversion is fail , return this value
Returns:
if conversion is fail , return faultValue,else return the value after converted

getByte

public static byte getByte(String s,
                           int faultValue)
String convert to byte 把字符串转换成byte

Parameters:
s - 字符串
faultValue - if conversion is fail , return this value
Returns:
if conversion is fail , return faultValue,else return the value after converted

getIpStringFromBytes

public static String getIpStringFromBytes(byte[] ip)
get String form form byte-array of IP

Parameters:
ip - byte-array of IP
Returns:
String form of IP

getIpByteArrayFromString

public static byte[] getIpByteArrayFromString(String ip)
get byte-array form form String of IP 从ip的字符串形式得到字节数组形式

Parameters:
ip - String form of IP
Returns:
Byte-Array of IP

isIpEquals

public static boolean isIpEquals(byte[] ip1,
                                 byte[] ip2)
estimate the ip whether is equal another ip 判断IP是否相等

Parameters:
ip1 - byte-array of ip
ip2 - byte-array of ip
Returns:
true if they are equal

getCommandString

public static String getCommandString(char cmd)
Parameters:
cmd - command type
Returns:
String type of command,just for test

getClusterCommandString

public static String getClusterCommandString(byte cmd)
get the String form of cluster operate,just for test 得到群操作的字符串形式,仅用于调试

Parameters:
cmd -
Returns:

getFileCommandString

public static String getFileCommandString(char command)
return String form of file command,just for test 返回文件命令的字符串形式,仅用作调试

Parameters:
command -
Returns:

getEncodingString

public static String getEncodingString(char encoding)
this is not for test ,we acture wanna invoke the method 这个不是用于调试的,真正要用的方法

Parameters:
encoding -
Returns:
String of encoding type

getNormalIMTypeString

public static String getNormalIMTypeString(char type)
return general type in the message, just for test 返回普通消息中的类型,仅用作调试

Parameters:
type -
Returns:

getIMReplyType

public static String getIMReplyType(byte type)
return response type of String form ,just for test 返回字符串形式的回复类型,仅用于调试

Parameters:
type - response type
Returns:
response type of String form

indexOf

public static int indexOf(byte[] buf,
                          int begin,
                          byte b)
start begin positions where Buf byte in the array to find an byte-array in b as long as any of the emergence of the first location 在buf字节数组中的begin位置开始,查找字节b出现的第一个位置

Parameters:
buf - a byte-array
begin - start with a unknow index
b - we wanna find the byte-array
Returns:
if find it out ,return it, else return -1.

indexOf

public static int indexOf(byte[] buf,
                          int begin,
                          byte[] b)
start begin positions where Buf byte in the array to find an byte-array in b as long as any of the emergence of the first location 在buf字节数组中的begin位置开始,查找字节数组b中只要任何一个出现的第一个位置

Parameters:
buf - a byte-array
begin - start with a unknow index
b - we wanna find the byte-array
Returns:
if find it out ,return it, else return -1.

random

public static Random random()
return a random object

Returns:
Random对象

randomKey

public static byte[] randomKey()
Returns:
random create a key- byte-array 一个随机产生的密钥字节数组

parseInt

public static final int parseInt(byte[] content,
                                 int offset)
Content from the offset position from the 4-byte analysis into the int type 从content的offset位置起的4个字节解析成int类型

Parameters:
content - byte - array
offset -
Returns:
int

parseChar

public static final char parseChar(byte[] content,
                                   int offset)
Content from the offset position from the 2-byte analysis into the char type 从content的offset位置起的2个字节解析成char类型

Parameters:
content - is byte - array
offset -
Returns:
char

getAuthActionString

public static final String getAuthActionString(byte b)
get the String form of authenticate type 得到认证操作字符串形式

Parameters:
b - byte of authenticate operate 认证操作字节
Returns:
String form 字符串形式

getAuthTypeString

public static final String getAuthTypeString(byte b)
get the String form of authenticate type 得到认证类型字符串形式

Parameters:
b - byte of authenticate type 认证类型字节
Returns:
String form 字符串形式

getSearchTypeString

public static final String getSearchTypeString(byte b)
get the string of search type 得到搜索类型的字符串

Parameters:
b - byte of search type 搜索类型字节
Returns:
String form 字符串形式

convertByteToHexString

public static String convertByteToHexString(byte[] b)
a Hex string band into a byte array 把字节数组转换成16进制字符串

Parameters:
b - byte-array 字节数组
Returns:
Hex String, Bytes each separated by spaces,no space in the head and tail. 16进制字符串,每个字节之间空格分隔,头尾无空格

convertByteToHexString

public static String convertByteToHexString(byte[] b,
                                            int offset,
                                            int len)
a Hex string band into a byte array 把字节数组转换成16进制字符串

Parameters:
b - 字节数组
offset - where start to convert 从哪里开始转换
len - length of conversion 转换的长度
Returns:
Hex String, Bytes each separated by spaces,no space in the head and tail. 16进制字符串,每个字节之间空格分隔,头尾无空格

convertByteToHexStringWithoutSpace

public static String convertByteToHexStringWithoutSpace(byte[] b)
a Hex string band into a byte array 把字节数组转换成16进制字符串

Parameters:
b - byte-array 字节数组
Returns:
Hex String, Bytes each separated by spaces 16进制字符串,每个字节没有空格分隔

convertByteToHexStringWithoutSpace

public static String convertByteToHexStringWithoutSpace(byte[] b,
                                                        int offset,
                                                        int len)
a Hex string band into a byte array 把字节数组转换成16进制字符串

Parameters:
b - byte-array 字节数组
offset - where start to conversion 从哪里开始转换
len - length of conversion 转换的长度
Returns:
Hex String, Bytes each separated by spaces 16进制字符串,每个字节没有空格分隔

convertHexStringToByte

public static byte[] convertHexStringToByte(String s)
a Hex string band into a byte array 转换16进制字符串为字节数组

Parameters:
s - Hex String, Bytes each separated by spaces 16进制字符串,每个字节由空格分隔
Returns:
byte-array,if occur error,return null , if the string is null,also return null 字节数组,如果出错,返回null,如果是空字符串,也返回null

convertHexStringToByteNoSpace

public static byte[] convertHexStringToByteNoSpace(String s)
a Hex string band into a byte array, string no spaces,so every ocharacters is two-byte 把一个16进制字符串转换为字节数组,字符串没有空格,所以每两个字符 一个字节

Parameters:
s -
Returns:

convertIpToString

public static String convertIpToString(byte[] ip)
use the byte-array of ip conversion String from 把ip的字节数组形式转换成字符串形式

Parameters:
ip - IP address byte-array, big endian ip地址字节数组,big-endian
Returns:
IP String ip字符串

findByteOffset

public static int findByteOffset(byte[] ar,
                                 byte b)
start from indicate location to search the location where a char appear 从头开始(包含指定位置)查找一个字节的出现位置

Parameters:
ar - byte-array 字节数组
b - the char which we wanna find 要查找的字节
Returns:
the location where the char appear, if not found, return -1 字节出现的位置,如果没有找到,返回-1

findByteOffset

public static int findByteOffset(byte[] ar,
                                 byte b,
                                 int from)
start from indicate location to search the location where a char appear 从指定位置开始(包含指定位置)查找一个字节的出现位置

Parameters:
ar - byte-array 字节数组
b - the byte we wanna find 要查找的字节
from - indicate location 指定位置
Returns:
the location where the char appear, if not found, return -1 字节出现的位置,如果没有找到,返回-1

findByteOffset

public static int findByteOffset(byte[] ar,
                                 byte b,
                                 int from,
                                 int occurs)
start from indicate location to search the location where next char appear the N th times 从指定位置开始(包含指定位置)查找一个字节的第N次出现位置

Parameters:
ar - byte-array 字节数组
b - the byte we wanna find 要查找的字节
from - indicate the location 指定位置
occurs - how many times appeared 第几次出现
Returns:
bytes of the N th times appear, if not found, return -1 字节第N次出现的位置,如果没有找到,返回-1

convertCharToBytes

public static byte[] convertCharToBytes(char c)
a char change to byte-Array 把一个char转换成字节数组

Parameters:
c - char 字符
Returns:
byte-Array,the size is 2 bytes 字节数组,2字节大小

getIntFromBytes

public static int getIntFromBytes(byte[] b,
                                  int offset,
                                  int len)
From the array of bytes from the designated location of the len bytes into int type (big-endian), if less than 4 bytes, that is high 0 从字节数组的指定位置起的len的字节转换成int型(big-endian),如果不足4字节,高位认为是0

Parameters:
b - byte array 字节数组
offset - start location of conversion 转换起始位置
len - length of conversion 转换长度
Returns:
the int number after conversion 转换后的int

getSubBytes

public static byte[] getSubBytes(byte[] b,
                                 int offset,
                                 int len)
get the apart of byte array 得到一个字节数组的一部分

Parameters:
b - source byte array 原始字节数组
offset - sub - array start move 子数组开始偏移
len - length of sub -Array 子数组长度
Returns:
子数组

get05CommandString

public static String get05CommandString(char command)
Parameters:
command -
Returns:

getFTPCommandString

public static String getFTPCommandString(char command)
Parameters:
command -
Returns:

getErrorString

public static String getErrorString(int error)
get the type of error 得到错误类型

Parameters:
error -
Returns:

getProtocolString

public static String getProtocolString(int p)
get the string of protocol,for debug 得到协议的字符串,for debug

Parameters:
p -
Returns:

JML