Space in Java path

Source: Internet
Author: User

If the path contains spaces
1. Uri. getpath (); the space in the returned path still appears in the form of "space", such as/F :/Myeclipse Workspace/Project/bin /...
In addition,URLSpaces in all returned paths are displayed in the format of "% 20,Uri. tostring () Is also in the form of "% 20.

2. New file (String filepath); AcceptCorrect URIFormat parameters and parameters with"Space"(Not 20%) CorrectRelative/absolute string pathOtherwise, the file cannot be found even if the given path is correct.

3.The path delimiters returned by URLs/Uris are all "/", and all the path delimiters returned by files are "/".For the path string returned by an existing file, all spaces are"Space"The new file does not exist. The space in the path returned by getpath () is still the original form of the new file (string filepath) parameter, that is, if the getpath () in filepath is a space, the returned space is still "% 20" or "% 20 ".

 

4. The new URL (); parameter can be a correct URI or a string in Uri format. If the string is not in complete URI format, creation fails.

 

5.File. touri ()The"Space" is converted to "% 20 ",Add protocol to the path: "File :/",However, file. tourl () simply adds Protocol: "file:/" before the file path, whileNoConvert "space" to "% 20". The original "space" or "% 20" will only be retained as is!

 

6. In Woden, the implementation of wsdlreader. readwsdl (string s) must convert the parameter S into a URL. Therefore, there must be no space in the string parameter S, and it should be replaced by "20%. The parameter S is preferably a string in the standard URI format.

 

 

 

-------------- If any of the above errors occurs, please give your advice. Thank you!

 

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.