Useful Tools for Spring3 collection

Source: Internet
Author: User
Tags file copy md5 encryption object object object serialization

1) Request Tool class Org.springframework.web.bind.ServletRequestUtilsInteger value of the fetch request parameter: public static integer getintparameter (servletrequest request, String name) public static int Getintparameter (ServletRequest request, String name, int defaultval)-- Single Valuepublic static int[] Getintparameters (servletrequest request, String name)-- ArrayAnd, for example, long, float, double, boolean, StringThe relevant processing methods. 2) String tool class Org.springframework.util.StringUtilsInitial capitalization: public static string capitalize (string str) Initial lowercase: public static string Uncapitalize (String str) Determines whether the string is null or Empty:public static Boolean haslength (String str) to determine whether the string is a non-whitespace string (that is, a string that contains at least one non-whitespace): public static Boolean HasText (String str) gets the file name: public static string GetFileName (string path), such as e.g. "Mypath/myfile.txt", "myfile.txt" Get file extension: public static string Getfilenameextension (string path) such as "mypath/ MyFile.txt "and" TXT "there are examples such as array-to-set, set-to-array, path-processing, string-separated array, arrays or collections merged into strings, array merges, adding elements to arrays, and so on. 3) object serialization and deserialization Org.springframework.util.SerializationUtilspublic static byte[] Serialize (Object object) public static Object deserialize (byte[] bytes) 4) Digital processing org.springframework.util.NumberUtilsThe string is converted to number and formatted, including the specific number implementation class, such as Long, Integer, Double, string supports 16 strings, and automatically removes spaces from the string: public static <t extends Number> T Parsenumber (String text, class<t> targetclass) public static <t extends number> T parsenumber ( String text, class<t> Targetclass, NumberFormatNumberFormat) conversions in various numbers, such as long dedicated to integer, automatically handle digital overflows (throwing Exceptions): public static <t extends number> T Convertnumbertotargetclass (number number, class<t> targetclass) 5) file copy org.springframework.util.FileCopyUtilsReplication between stream and stream, stream to string, byte array to stream, etc. 6) directory replication Org.springframework.util.FileSystemUtilsRecursively copy, delete a directory 7) MD5 encryption Org.springframework.util.DigestUtilsByte array MD5 encrypted public static String Md5digestashex (byte[] bytes)

Useful Tools for Spring3 collection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.