+ private final static String delimStr = "/";
+ private final static char delimChar = '/';
+
+ private final JcrFileSystem fs;
+ private final String[] path;// null means root
+ private final boolean absolute;
+
+ // optim
+ private final int hashCode;
+
+ public JcrPath(JcrFileSystem filesSystem, String path) {
+ this.fs = filesSystem;
+ if (path == null)
+ throw new JcrFsException("Path cannot be null");
+ if (path.equals(delimStr)) {// root
+ this.path = null;
+ this.absolute = true;
+ this.hashCode = 0;
+ return;
+ } else if (path.equals("")) {// empty path
+ this.path = new String[] { "" };
+ this.absolute = false;
+ this.hashCode = "".hashCode();
+ return;
+ }
+
+ if (path.equals("~")) {// home
+ path = filesSystem.getUserHomePath();
+ if (path == null)
+ throw new JcrFsException("No home directory available");
+ }