PS: Welcome to add QQ Friends: 2318645572, Exchange learning
One: Path conversion
The file path format in Windows is D:\eclipse\apache-tomcat-7.0.67\wtpwebapps\ ...
The file path format in Java is d:/eclipse/apache-tomcat-7.0.67/wtpwebapps/...
If you use the path of Windows directly, an exception is thrown when you write with a stream
Using the former in Java will result in an error, so you need to first convert the file path in Windows to a recognized path in Java.
For the following treatment:
String str = "D:\eclipse\apache-tomcat-7.0.67\wtpwebapps\ ...";
String Newurl = str.replaceall ("\\\\", "/");
The value of this newurl is d:/eclipse/apache-tomcat-7.0.67/wtpwebapps/...
II: Summary of various escape characters
- Octal escape sequence: \ + 1 to 3 digit 5 digit; Range ' \000 ' ~ ' \377 ': null character
- Unicode escape character: \u + four hexadecimal digits; 0~65535 \u0000: null character
- Special characters: 3
\ ": Double quotation marks
\ ': Single quote
\ \: Backslash
4. Control characters: 5
\ ' Single quote character
\ \ backslash Character
\ r Enter
\ nthe line break
\f Paper Change page
\ t transverse jump lattice
\b Backspace
Escape of points:. ==> u002e
Escape of Dollar sign: $ ==> u0024
The escape of the symbol of the exponent: ^ ==> u005e
Escape of opening curly brace: {==> u007b
Escape of the left parenthesis: [==> u005b
Escape of the Left parenthesis: (==> u0028
Escape of vertical bars: | ==> u007c
Escape of Right parenthesis:) ==> u0029
Escape of asterisks: * ==> u002a
Escape of the plus sign: + ==> u002b
Escape of question marks:? ==> u003f
Anti-slash escape: ==> u005c
The Windows file path is converted to an escaped method of a recognized file path in Java (with escape in multiple formats)