org.linkedin.util-core/src/main/java/org/linkedin/util/io/resource/internal/AbstractResourceProvider.java
@Override
  public InternalResource chroot(InternalResource resource)
  {
    String path = resource.getPath();

    // when it is a directory, we simply use the provided resource
    if(resource.isDirectory())
    {
      return doCreateResourceProvider(path).getRootResource();
    }
    else
    {
      // when not a directory, we do a chroot to the parent and then we return the resource
      // that points to it
      return (InternalResource) resource.chroot("..").createRelative(resource.getFilename());
    }
  }
@Override
  public InternalResource chroot(InternalResource resource)
  {
    String path = resource.getPath();

    // when it is a directory, we simply use the provided resource
    if(resource.isDirectory())
    {
      return doCreateResourceProvider(path).getRootResource();
    }
    else
    {
      // when not a directory, we do a chroot to the parent and then we return the resource
      // that points to it
      return (InternalResource) resource.chroot("..").createRelative(resource.getFilename());
    }
  }
@ Override public InternalResource chroot ( InternalResource resource ) { String path = resource . getPath ( ) ; // when it is a directory, we simply use the provided resource if ( resource . isDirectory ( ) ) { return doCreateResourceProvider ( path ) . getRootResource ( ) ; } else { // when not a directory, we do a chroot to the parent and then we return the resource // that points to it return ( InternalResource ) resource . chroot ( ".." ) . createRelative ( resource . getFilename ( ) ) ; } }
Returns a new resource with the root resource set to this resource.

@return the new resource
Returns a new resource with the root resource set to this resource .