2026-03-17 13:31:18 -07:00

105 lines
2.9 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package javax.baja.virtual;
import javax.baja.naming.SlotPath;
import javax.baja.naming.SyntaxException;
import javax.baja.sys.IllegalNameException;
public final class VirtualPath
extends SlotPath {
public static final VirtualPath convertFromSlotPath(SlotPath slotPath) {
String[] stringArray = slotPath.getNames();
int n = stringArray.length;
String[] stringArray2 = new String[n];
int n2 = 0;
while (n2 < n) {
stringArray2[n2] = SlotPath.unescape(stringArray[n2]);
++n2;
}
if (slotPath.isAbsolute()) {
return new VirtualPath("virtual", stringArray2);
}
n2 = slotPath.getBackupDepth();
StringBuffer stringBuffer = new StringBuffer();
int n3 = 0;
while (n3 < n2) {
stringBuffer.append("../");
++n3;
}
n3 = 0;
while (n3 < n) {
if (n3 != 0) {
stringBuffer.append("/");
}
stringBuffer.append(stringArray2[n3]);
++n3;
}
return new VirtualPath(stringBuffer.toString());
}
protected final SlotPath makeSlotPath(String string, String string2) {
return new VirtualPath(string, string2);
}
protected final boolean isValidPathName(String string) {
return VirtualPath.isValidName(string);
}
public static final boolean isValidName(String string) {
if (string == null) {
return false;
}
int n = string.length();
if (n < 1) {
return false;
}
int n2 = 0;
while (n2 < n) {
char c = string.charAt(n2);
switch (c) {
case '$':
case '/':
case ':':
case '|': {
return false;
}
}
++n2;
}
return true;
}
public static final void verifyValidName(String string) {
if (!VirtualPath.isValidName(string)) {
throw new IllegalNameException("baja", "IllegalNameException.name", new Object[]{string});
}
}
public static final String escape(String string) {
throw new UnsupportedOperationException("escape() not implemented for VirtualPath.");
}
public static final String unescape(String string) {
throw new UnsupportedOperationException("unescape() not implemented for VirtualPath.");
}
public final String toDisplayString() {
return this.getBody();
}
public VirtualPath(String string, String string2) throws SyntaxException {
super(string, string2);
}
public VirtualPath(String string, String[] stringArray) throws SyntaxException {
super(string, stringArray);
}
public VirtualPath(String string) throws SyntaxException {
super("virtual", string);
}
}