1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.millscript.commons.vfs.util;
22
23 import org.millscript.commons.alert.alerts.Fault;
24 import org.millscript.commons.vfs.VEntry;
25
26 import java.net.URI;
27 import java.net.URISyntaxException;
28
29 /**
30 * This class provides a base for the implementation of a chroot'd virtual
31 * filesystem entry.
32 */
33 public abstract class AbstractChrootEntry implements VEntry {
34
35 /**
36 * @see org.millscript.commons.vfs.VEntry#appendAbsolutePath(java.lang.StringBuffer)
37 */
38 public final StringBuffer appendAbsolutePath( final StringBuffer buffer ) {
39 return this.appendRelativePath( buffer.append( '/' ) );
40 }
41
42 /**
43 * @see org.millscript.commons.vfs.VEntry#appendAbsolutePathOnVolume(java.lang.StringBuffer)
44 */
45 public final StringBuffer appendAbsolutePathOnVolume( final StringBuffer buffer ) {
46 return this.appendRelativePathOnVolume( buffer.append( '/' ) );
47 }
48
49 /**
50 * @see org.millscript.commons.vfs.VEntry#appendRelativePathOnVolume(java.lang.StringBuffer)
51 */
52 public final StringBuffer appendRelativePathOnVolume( final StringBuffer buffer ) {
53 return this.appendRelativePath( buffer );
54 }
55
56 /**
57 * @see org.millscript.commons.vfs.VEntry#getAbsolutePath()
58 */
59 public final String getAbsolutePath() {
60 return this.appendAbsolutePath( new StringBuffer() ).toString();
61 }
62
63 /**
64 * @see org.millscript.commons.vfs.VEntry#getAbsolutePathOnVolume()
65 */
66 public final String getAbsolutePathOnVolume() {
67 return this.appendAbsolutePathOnVolume( new StringBuffer() ).toString();
68 }
69
70 /**
71 * @see org.millscript.commons.vfs.VEntry#getRelativePath()
72 */
73 public final String getRelativePath() {
74 return this.appendRelativePath( new StringBuffer() ).toString();
75 }
76
77 /**
78 * @see org.millscript.commons.vfs.VEntry#getRelativePathOnVolume()
79 */
80 public final String getRelativePathOnVolume() {
81 return this.appendRelativePathOnVolume( new StringBuffer() ).toString();
82 }
83
84 /**
85 * @see org.millscript.commons.vfs.VEntry#getURI()
86 */
87 public final URI getURI() {
88 try {
89 return new URI( this.appendURI( new StringBuffer() ).toString() );
90 } catch ( URISyntaxException ex ) {
91 throw new Fault(
92 "Could not make a valid URI from this virtual filesystem entry"
93 ).culprit( "ventry", this ).mishap();
94 }
95 }
96
97 }