@Override public boolean endsWith( final String other ) throws InvalidPathException { checkNotNull( "other", other ); return endsWith( getFileSystem().getPath( other ) ); }
@Override public Path toAbsolutePath() throws IOException, SecurityException { if ( isAbsolute() ) { return this; } if ( host.isEmpty() ) { return newPath( fs, FilenameUtils.normalize( defaultDirectory() + toString(), !usesWindowsFormat ), host, isRealPath, true ); } return newPath( fs, defaultDirectory() + toString( false ), host, isRealPath, true ); }
if ( this.equals( other ) ) { return emptyPath(); if ( isAbsolute() != other.isAbsolute() ) { throw new IllegalArgumentException(); if ( isAbsolute() && !this.getRoot().equals( other.getRoot() ) ) { throw new IllegalArgumentException(); int n = ( getNameCount() > other.getNameCount() ) ? other.getNameCount() : getNameCount(); int i = 0; while ( i < n ) { if ( !this.getName( i ).equals( other.getName( i ) ) ) { break; int numberOfDots = getNameCount() - i; if ( numberOfDots == 0 && i < other.getNameCount() ) { return other.subpath( i, other.getNameCount() ); sb.append( ".." ); if ( numberOfDots > 1 ) { sb.append( getSeparator() ); if ( i < other.getNameCount() ) { if ( sb.length() > 0 ) { sb.append( getSeparator() ); sb.append( ( (AbstractPath<FS>) other.subpath( i, other.getNameCount() ) ).toString( false ) );
@Override public Path getFileName() { if ( getNameCount() == 0 ) { return null; } return getName( getNameCount() - 1 ); }
public OtherMetaView( final AbstractPath path ) { super( path ); final Map<String, Object> content = path.getAttrStorage().getContent(); final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView( path, BasicFileAttributeView.class ).readAttributes();
@Override public boolean startsWith( final String other ) throws InvalidPathException { checkNotNull( "other", other ); return startsWith( getFileSystem().getPath( other ) ); }
@Override public <T extends BasicFileAttributes> T readAttributes() throws org.kie.commons.java.nio.IOException { if ( attrs == null ) { final BasicFileAttributes basicAtts = ( (BasicFileAttributeView) path.getAttrView( BasicFileAttributeView.class ) ).readAttributes(); attrs = new DublinCoreAttributes( basicAtts, (String) path.getAttrStorage().getContent().get( "dcore.author" ) ); } return (T) attrs; }
public ConfigView( final AbstractPath path ) { super( path ); final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView( path, BasicFileAttributeView.class ).readAttributes();
@Override public synchronized Path write( final Path path, final byte[] bytes, final Set<? extends OpenOption> options, final FileAttribute<?>... attrs ) throws IllegalArgumentException, IOException, UnsupportedOperationException { SeekableByteChannel byteChannel; try { byteChannel = newByteChannel( path, buildOptions( options ), attrs ); } catch ( final FileAlreadyExistsException ex ) { ( (AbstractPath) path ).clearCache(); byteChannel = newByteChannel( path, buildOptions( options, TRUNCATE_EXISTING ), attrs ); } try { byteChannel.write( ByteBuffer.wrap( bytes ) ); byteChannel.close(); } catch ( final java.io.IOException e ) { throw new IOException( e ); } return path; }
public DiscussionView( final AbstractPath path ) { super( path ); final Map<String, Object> content = path.getAttrStorage().getContent(); final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView( path, BasicFileAttributeView.class ).readAttributes();
@Override public Path next() { if ( i < getNameCount() ) { Path result = getName( i ); i++; return result; } else { throw new NoSuchElementException(); } }
throw new IOException( e ); } finally { ( (AbstractPath) path ).clearCache();
public DublinCoreView( final AbstractPath path ) { super( path ); final Map<String, Object> content = path.getAttrStorage().getContent(); final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView( path, BasicFileAttributeView.class ).readAttributes();