public void load( final InputStream in ) { load( in, true ); }
protected void loadDotFile( final Path path ) { final Properties content = new Properties(); content.load( newInputStream( dot( path ) ) ); if ( path instanceof AttrHolder ) { ( (AttrHolder) path ).getAttrStorage().loadContent( content ); } }
@Override public Map<String, Object> readAttributes( final Path path, final String attributes ) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException { checkNotNull( "path", path ); checkNotEmpty( "attributes", attributes ); final Properties original = new Properties( Files.readAttributes( path, attributes ) ); if ( attributes.equals( "*" ) && exists( dot( path ) ) ) { boolean isAttrHolder = path instanceof AttrHolder; if ( isAttrHolder && ( (AttrHolder) path ).getAttrStorage().getContent().size() > 0 ) { return ( (AttrHolder) path ).getAttrStorage().getAllContent(); } final Properties content = new Properties(); content.load( newInputStream( dot( path ) ) ); content.putAll( original ); if ( isAttrHolder ) { ( (AttrHolder) path ).getAttrStorage().loadContent( content ); } return content; } return original; }
protected synchronized Path internalCreateDirectory( final Path dir, final boolean skipAlreadyExistsException, final FileAttribute<?>... attrs ) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull( "dir", dir ); FileAttribute<?>[] allAttrs = attrs; try { Files.createDirectory( dir, attrs ); } catch ( final FileAlreadyExistsException ex ) { final Properties properties = new Properties(); if ( exists( dot( dir ) ) ) { properties.load( newInputStream( dot( dir ) ) ); } allAttrs = consolidate( properties, attrs ); if ( !skipAlreadyExistsException ) { throw ex; } } buildDotFile( dir, newOutputStream( dot( dir ) ), allAttrs ); return dir; }
@Override public synchronized SeekableByteChannel newByteChannel( final Path path, final Set<? extends OpenOption> options, final FileAttribute<?>... attrs ) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { checkNotNull( "path", path ); final Properties properties = new Properties(); if ( exists( dot( path ) ) ) { properties.load( newInputStream( dot( path ) ) ); } final FileAttribute<?>[] allAttrs = consolidate( properties, attrs ); final SeekableByteChannel result = Files.newByteChannel( path, buildOptions( options ), allAttrs ); if ( isFileScheme( path ) ) { buildDotFile( path, newOutputStream( dot( path ) ), allAttrs ); } return result; }