Usage and introduction of smartupload

Source: Internet
Author: User

 

 

 

Use the followingCodeGenerate the file name.

 1   Package  Info. haowei. util;  2   3   Import  Java. Text. simpledateformat;  4   Import  Java. util. date; 5   Import  Java. util. Random;  6   7   Public   Class  Iptimestamp {  8   9       10       Private Simpledateformat SDF = Null  ;  11       Private String IP =Null  ;  12       13       14       Public  Iptimestamp (string IP ){  15           Super  ();  16       17           This . IP = IP address;  18   }  19  20   21       Public  Iptimestamp (){  22           Super  ();  23   }  24       25       26       Public  String getiptimerand (){  27 Stringbuffer Buf = New Stringbuffer ();  28           If ( This . IP! = Null  ){  29 String s [] = This . IP. Split ("\\." ); // Extract the numbers in the IP address based on the IP address.  30               For ( Int I = 0; I <S. length; I ++ ){  31 Buf. append (This . Addzero (s [I], 3 ); // Zero of three digits  32   }  33   }  34 Buf. append ( This  . Gettimestamp ());  35 Random r = New  Random (); // Add three random numbers at the end.  36           For ( Int I = 0; I <3; I ++ ){  37 Buf. append (R. nextint (10 ));  38   }  39           Return  Buf. tostring ();  40   }  41       42       Private String addzero (string STR, Int  Len ){ 43           44 Stringbuffer S = New  Stringbuffer ();  45   S. append (STR );  46           While (S. Length () < Len ){  47 S. insert (0, 0 );  48   }  49           50          Return  S. tostring ();  51   }  52       53       54       Private  String gettimestamp () {// obtain the timestamp  55           This . SDF = New Simpledateformat ("yyyymmddhhmmsssss" );  56           Return   This . SDF. Format ( New  Date ());  57   }  58       59       Public  String getdate (){  60           This . SDF = New Simpledateformat ("yyyy-mm-dd hh: mm: Ss. Sss" );  61           Return   This . SDF. Format (New  Date ());  62   }  63 }

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.