< prev index next >

src/java.base/windows/classes/java/io/WinNTFileSystem.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD


  47 
  48     public WinNTFileSystem() {
  49         Properties props = GetPropertyAction.privilegedGetProperties();
  50         slash = props.getProperty("file.separator").charAt(0);
  51         semicolon = props.getProperty("path.separator").charAt(0);
  52         altSlash = (this.slash == '\\') ? '/' : '\\';
  53         userDir = normalize(props.getProperty("user.dir"));
  54         cache = useCanonCaches ? new ExpiringCache() : null;
  55         prefixCache = useCanonPrefixCache ? new ExpiringCache() : null;
  56     }
  57 
  58     private boolean isSlash(char c) {
  59         return (c == '\\') || (c == '/');
  60     }
  61 
  62     private boolean isLetter(char c) {
  63         return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'));
  64     }
  65 
  66     private String slashify(String p) {
  67         if ((p.length() > 0) && (p.charAt(0) != slash)) return slash + p;
  68         else return p;
  69     }
  70 
  71     /* -- Normalization and construction -- */
  72 
  73     @Override
  74     public char getSeparator() {
  75         return slash;
  76     }
  77 
  78     @Override
  79     public char getPathSeparator() {
  80         return semicolon;
  81     }
  82 
  83     /* Check that the given pathname is normal.  If not, invoke the real
  84        normalizer on the part of the pathname that requires normalization.
  85        This way we iterate through the whole pathname string only once. */
  86     @Override
  87     public String normalize(String path) {




  47 
  48     public WinNTFileSystem() {
  49         Properties props = GetPropertyAction.privilegedGetProperties();
  50         slash = props.getProperty("file.separator").charAt(0);
  51         semicolon = props.getProperty("path.separator").charAt(0);
  52         altSlash = (this.slash == '\\') ? '/' : '\\';
  53         userDir = normalize(props.getProperty("user.dir"));
  54         cache = useCanonCaches ? new ExpiringCache() : null;
  55         prefixCache = useCanonPrefixCache ? new ExpiringCache() : null;
  56     }
  57 
  58     private boolean isSlash(char c) {
  59         return (c == '\\') || (c == '/');
  60     }
  61 
  62     private boolean isLetter(char c) {
  63         return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'));
  64     }
  65 
  66     private String slashify(String p) {
  67         if (!p.isEmpty() && p.charAt(0) != slash) return slash + p;
  68         else return p;
  69     }
  70 
  71     /* -- Normalization and construction -- */
  72 
  73     @Override
  74     public char getSeparator() {
  75         return slash;
  76     }
  77 
  78     @Override
  79     public char getPathSeparator() {
  80         return semicolon;
  81     }
  82 
  83     /* Check that the given pathname is normal.  If not, invoke the real
  84        normalizer on the part of the pathname that requires normalization.
  85        This way we iterate through the whole pathname string only once. */
  86     @Override
  87     public String normalize(String path) {


< prev index next >