private void normalizeParentCase( RealIt it ) { if( !isRoot( it.path ) ) { it.path = childGetParent( it.path ); } } }
@Override public void write( Elsewhere elsew, Path path ) { Filess.createDirectories( path ); } }
@Override public int getPathLength( String str ) { return PathSpec.getBytes( str ).length; }
public static Path createFile( Path root, byte[] content, String one, String... names ) { Path ret = root.resolve( one ); for( String name : names ) { ret = ret.resolve( name ); } Filess.createDirectories( childGetParent( ret)); Filess.write( ret, content ); return ret; }
static PathSpec byOS( OS os ) { if ( os.isWindows() ) { return new PathSpecWindows(); } if ( os.isOSX() ) { return new PathSpecOSX(); } if ( os.isUnix() ) { return new PathSpecUnix(); } return new PathSpecDefault(); }
public FSElsewhere( Path root, UUID uuid ) { if ( !root.isAbsolute()) { throw new IllegalArgumentException( "fselwhere root must be absolute " + root ); } if ( !isRoot( root ) && Files.exists( childGetParent( root))) { Filess.createDirectories( root ); } this.root = root; this.uuid = uuid; }
public UnixBuilder<T> hfsPlus() { PathLimits pathLimits = new PathLimits( OS.OSX ); PathSpec pathSpec = new PathSpecOSX(); descr.props.put( Tests10PathWithContent.ONE_CHAR_COUNT, pathLimits.getBigChar() ); descr.props.put( Tests10PathWithContent.MAX_FILENAME_LENGTH, pathSpec.getMaxFilenameLength() ); descr.props.put( Tests10PathWithContent.MAX_PATH_LENGTH, pathSpec.getMaxPathLength() ); descr.props.put( Tests10PathWithContent.GET_FILENAME_LENGTH, (Function<String,Integer>)pathSpec::getFilenameLength ); descr.props.put( Tests10PathWithContent.GET_PATH_LENGTH, (Function<String,Integer>)pathSpec::getPathLength ); descr.addTopic( CaseInsensitive.class ); descr.removeTopic( NotOSX.class ); // todo : is seperator (in a way) return this; }
/** * Moves the content of source to path * This method works in mostly the manner * specified by the {@link java.nio.file.Files#move} method. * but: * source and target are absolute paths of the same filesystem * source path is sym link free * target does not exist * target parent does exist * * @param source * @param target */ default void move( EightyPath source, EightyPath target ) { FileTime lastModi = Filess.getLastModifiedTime( source ); Pathss.copyRecursive( source, target ); Pathss.deleteRecursive( source ); Filess.setLastModifiedTime( target, lastModi ); }
default PathSpec getPathSpec() { return new PathSpecUnix(); }
public boolean consumed() { return os.getCount() >= upto; }
public static long copy( InputStream input, OutputStream output ) { return copy( input, output, new byte[ 8096 ] ); }
@Override public Object fromString(String str, Map<String, Object> env) { return Pathss.getPath( str, env); }
public static String fsFriendlyName( Instant inst ) { return getDateTimeString( inst );//dtf.format(inst); }
protected Path otherProviderFileA() { Path ret = otherProviderAbsA(); if( !Files.exists( ret ) ) { Filess.createDirectories( childGetParent( ret ) ); Filess.write( ret, CONTENT ); } return ret; }
public Path dirTB() { Path ret = absTB(); Filess.createDirectories( ret ); return ret; }
@Override public int getFilenameLength( String str ) { return PathSpec.getBytes( str ).length; }
private Path targetDir() { Path target = childGetParent( targetDirKid() ); if( !Files.exists( target ) ) { Filess.createDirectories( target ); Filess.write( targetDirKid(), CONTENT ); // one kid } return target; }
@Override public int getPathLength( String str ) { return PathSpec.getBytes( str ).length; }
@Override public int getFilenameLength( String str ) { return PathSpec.getBytes( str ).length; }
@Override public int getPathLength( String str ) { return PathSpec.getBytes( str ).length; // UTF8 where filename is UTF16 codepoints }