本文整理匯總了Java中de.pfabulist.kleinod.os.OS類的典型用法代碼示例。如果您正苦於以下問題:Java OS類的具體用法?Java OS怎麽用?Java OS使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
OS類屬於de.pfabulist.kleinod.os包,在下文中一共展示了OS類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: UnixBuilder
import de.pfabulist.kleinod.os.OS; //導入依賴的package包/類
public UnixBuilder( FSDescription descr, T t ) {
super( descr, t );
PathLimits pathLimits = new PathLimits( OS.UNIX );
PathSpec pathSpec = new PathSpecUnix();
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.removeTopic( LimitedPath.class ); theory but linux c limits
descr.removeTopic( Windows.class );
descr.removeTopic( DosAttributesT.class );
descr.removeTopic( CaseInsensitive.class );
descr.removeTopic( NonCasePreserving.class );
descr.attributeDescriptions.put( "posix", attributeBuilding( Posix.class, "posix", PosixFileAttributeView.class, PosixFileAttributes.class ).
addAttribute( "owner", PosixFileAttributes::owner ).
addAttribute( "permissions", PosixFileAttributes::permissions ).
addAttribute( "group", PosixFileAttributes::group ).
build());
}
示例2: create
import de.pfabulist.kleinod.os.OS; //導入依賴的package包/類
public static EightyFS create( Object hostRoot, RWAttributesBuilder ab, Map<String, Object> env ) {
OS os = new OS();
ab.addOwner();
if( os.isUnix() ) {
ab.addPosix();
}
if( os.isWindows() ) {
ab.addDos();
}
ab.addOwner().addPosix();
return new SubFS( (Path) hostRoot );
}
示例3: WindowsBuilder
import de.pfabulist.kleinod.os.OS; //導入依賴的package包/類
public WindowsBuilder( FSDescription descr, T t ) {
super( descr, t );
descr.removeTopic( Unix.class );
PathLimits pathLimits = new PathLimits( OS.WINDOWS );
PathSpec pathSpec = new PathSpecWindows();
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.removeTopic( Posix.class );
descr.removeTopic( MoveWhile.class );
descr.removeTopic( NonCasePreserving.class );
descr.removeTopic( FileKeyT.class );
descr.attributeDescriptions.put( "dos",
attributeBuilding( DosAttributesT.class, "dos", DosFileAttributeView.class, DosFileAttributes.class ).
addAttribute( "hidden", DosFileAttributes::isHidden ).
addAttribute( "archive", DosFileAttributes::isArchive ).
addAttribute( "system", DosFileAttributes::isSystem ).
addAttribute( "readonly", DosFileAttributes::isReadOnly ).
build() );
}
示例4: hfsPlus
import de.pfabulist.kleinod.os.OS; //導入依賴的package包/類
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;
}
示例5: testFilenameTooLongBecauseUnicode
import de.pfabulist.kleinod.os.OS; //導入依賴的package包/類
@Test
@Category( { Unix.class, NotOSX.class, MaxFilename.class } )
public void testFilenameTooLongBecauseUnicode() throws IOException {
String str = new String( Character.toChars( 0x10400 ) );
PathLimits limits = new PathLimits( OS.UNIX );
String fname = longFileName( limits.getMaxPathLength() - str.length(), str );
assertThat( fname.length() ).isLessThan( limits.filenameCount( fname ) );
assertThatThrownBy( () -> Files.write( absT().resolve( fname ), CONTENT ) ).isInstanceOf( FileSystemException.class );
}
示例6: beforeClass
import de.pfabulist.kleinod.os.OS; //導入依賴的package包/類
@BeforeClass
public static void beforeClass() throws IOException {
// Ref<String> external = Ref.valueOf( "open" );
Path host = Pathss.getTmpDir( "cl1test" );
Files.createDirectories( host );
FileSystem fs = CloseableProvider.getUrim().getOrCreateFS( host, Collections.emptyMap() );
Path hostcl = Pathss.getTmpDir( "cl2test" );
Files.createDirectories( hostcl );
FileSystem fscl = CloseableProvider.getUrim().getOrCreateFS( hostcl, Collections.emptyMap() );
OS os = new OS();
PathSpec pspec = PathSpec.byOS( os );
int pathLength = pspec.getMaxPathLength() - pspec.getPathLength( host.toString() );
if ( os.isOSX() ) {
capa = build().
unix().hfsPlus().noPermissionChecks().next().
pathConstraints().pathLength( pathLength ).next().
playground().set( fs.getPath( "/testing" ) ).
hardlinks().no().
closable().no().
symlinks().no().
watchable().no().
fileStores().no().
fileChannel().no().
secondFS().no().
closable().playground( fscl.getPath( "/doit" ) ).
time().noCreationTime().noLastAccessTime().attributeDelay( 2000 ).next().
bug( "testReadAttributesViewFutureExistingFile" ).
bug( "testMoveLinkDoesNotChangeLastModifiedTime" ).
bug( "testMoveWhileWriting" ).
bug( "testReadChannelOfDirDoesNotThrow" ).
bug( "testFileKeyIsKeptInMove" ). // move impl via copy delete
bug( "testTruncateOnAppendChannelThrows" ). // inherited from host
done();
} else if ( os.isUnix() ) {
capa = build().
unix().noPosix().next().
playground().set( fs.getPath( "/testing" ) ).
pathConstraints().pathLength( pathLength ).next().
hardlinks().no().
closable().playground( fscl.getPath( "/doit" ) ).
symlinks().no().
watchable().no().
fileStores().no().
fileChannel().no().
time().noCreationTime().noLastAccessTime().next().
bug( "testReadAttributesViewFutureExistingFile" ).
bug( "testMoveLinkDoesNotChangeLastModifiedTime" ).
bug( "testMoveWhileWriting" ).
bug( "testReadChannelOfDirDoesNotThrow" ).
bug( "testFileKeyIsKeptInMove" ).
bug( "testTruncateOnAppendChannelThrows" ). // inherited from host
done();
} else if ( os.isWindows()) {
// capa = build().
// windows().next().
// playground().set( fs.getPath( "/testing" ) ).
// time().nolastAccessTime( !os.isWindows() ).yes().
// hardlinks().no().
// closeable().no().
// fileChannels( false ).
// symlinks().no().
// watchService().no().
// fileChannels( false ).
// fileStores().no().
// time().lastAccessTime( false ).creationTime( !os.isUnix() ).yes().
// readOnly().no().
// bug( "testEveryChannelWriteUpdatesLastModifiedTime", os.isWindows() ).
// bug( "testReadAttributesViewFutureExistingFile" ).
// bug( "testMoveLinkDoesNotChangeLastModifiedTime" ).
// bug( "testMoveWhileWriting" ).
// build();
}
}
示例7: beforeClass
import de.pfabulist.kleinod.os.OS; //導入依賴的package包/類
@BeforeClass
public static void beforeClass() throws IOException {
Path host = Pathss.getTmpDir( "symtest" );
Files.createDirectories( host );
FileSystem fs = SymlFileSystemProvider.getUrim().getOrCreateFS( host, Collections.emptyMap() );
OS os = new OS();
PathSpec pspec = PathSpec.byOS( os );
int pathLength = pspec.getMaxPathLength() - pspec.getPathLength( host.toString() );
if ( os.isOSX() ) {
capa = build().
unix().hfsPlus().noPermissionChecks().next().
pathConstraints().pathLength( pathLength ).next().
playground().set( fs.getPath( "/testing" ) ).
hardlinks().no().
closable().no().
watchable().no().
secondFS().no().
fileStores().no().
fileChannel().no().
time().noCreationTime().noLastAccessTime().attributeDelay( 2000 ).next().
bug( "testReadAttributesViewFutureExistingFile" ).
bug( "testMoveLinkDoesNotChangeLastModifiedTime" ).
bug( "testMoveWhileWriting" ).
bug( "testReadChannelOfDirDoesNotThrow" ).
bug( "testFileKeyIsKeptInMove" ). // move impl via copy delete
bug( "testTruncateOnAppendChannelThrows" ). // inherited from host
bug( "testMoveSymLinkDoesNotChangeLastModifiedTime" ).
done();
} else if ( os.isUnix() ) {
capa = build().
unix().noPermissionChecks().next().
pathConstraints().pathLength( pathLength ).next().
playground().set( fs.getPath( "/testing" ) ).
hardlinks().no().
closable().no().
// symlinks().no().
watchable().no().
fileStores().no().
fileChannel().no().
time().noCreationTime().noLastAccessTime().next().
//readOnly().no().
bug( "testReadAttributesViewFutureExistingFile" ).
bug( "testMoveLinkDoesNotChangeLastModifiedTime" ).
bug( "testMoveWhileWriting" ).
bug( "testReadChannelOfDirDoesNotThrow" ).
bug( "testMoveSymLinkDoesNotChangeLastModifiedTime" ).
bug( "testTruncateOnAppendChannelThrows" ). // inherited from host
bug( "testFileKeyIsKeptInMove" ).
done();
} else if( os.isWindows() ) {
// capa = build().
// windows().next().
// playground().set( fs.getPath( "/testing" ) ).
// time().nolastAccessTime( !os.isWindows() ).yes().
// hardlinks().no().
// closeable().no().
// fileChannels( false ).
// symlinks().no().
// watchService().no().
// fileChannels( false ).
// fileStores().no().
// time().lastAccessTime( false ).creationTime( !os.isUnix() ).yes().
// readOnly().no().
// bug( "testEveryChannelWriteUpdatesLastModifiedTime", os.isWindows() ).
// bug( "testReadAttributesViewFutureExistingFile" ).
// bug( "testMoveLinkDoesNotChangeLastModifiedTime" ).
// bug( "testMoveWhileWriting" ).
// build();
}
}
示例8: beforeClass
import de.pfabulist.kleinod.os.OS; //導入依賴的package包/類
@BeforeClass
public static void beforeClass() throws IOException {
Path host = Pathss.getTmpDir( "subtest" );
Files.createDirectories( host );
FileSystem fs = SubFileSystemProvider.getUrim().getOrCreateFS( host, Collections.emptyMap() );
// path limits are inherited from host
// but maxpath is shortened by guest root length
OS os = new OS();
PathSpec pspec = PathSpec.byOS( os );
int pathLength = pspec.getMaxPathLength() - pspec.getPathLength( host.toString() );
if ( os.isOSX() ) {
capa = build().
unix().hfsPlus().noPermissionChecks().next().
pathConstraints().pathLength( pathLength ).next().
playground().set( fs.getPath( "/testing" ) ).
secondFS().no().
hardlinks().no().
closable().no().
symlinks().no().
watchable().no().
fileStores().no().
fileChannel().no().
time().noCreationTime().noLastAccessTime().attributeDelay( 2000 ).next().
bug( "testReadAttributesViewFutureExistingFile" ).
bug( "testMoveLinkDoesNotChangeLastModifiedTime" ).
bug( "testMoveWhileWriting" ).
bug( "testReadChannelOfDirDoesNotThrow" ).
bug( "testFileKeyIsKeptInMove" ). // move impl via copy delete
bug( "testTruncateOnAppendChannelThrows" ). // inherited from host
done();
} else if ( os.isUnix() ) {
capa = build().
unix().noPermissionChecks().next().
playground().set( fs.getPath( "/testing" ) ).
pathConstraints().pathLength( pathLength ).next().
hardlinks().no().
closable().no().
symlinks().no().
watchable().no().
fileStores().no().
fileChannel().no().
time().noCreationTime().noLastAccessTime().next().
bug( "testReadAttributesViewFutureExistingFile" ).
bug( "testMoveLinkDoesNotChangeLastModifiedTime" ).
bug( "testMoveWhileWriting" ).
bug( "testReadChannelOfDirDoesNotThrow" ).
bug( "testFileKeyIsKeptInMove" ). // move impl via copy delete
bug( "testTruncateOnAppendChannelThrows" ). // inherited from host
done();
} else if ( os.isWindows()) {
// capa = build().
// windows().next().
// playground().set( fs.getPath( "/testing" ) ).
// time().nolastAccessTime( !os.isWindows() ).yes().
// hardlinks().no().
// closeable().no().
// fileChannels( false ).
// symlinks().no().
// watchService().no().
// fileChannels( false ).
// fileStores().no().
// time().lastAccessTime( false ).creationTime( !os.isUnix() ).yes().
// readOnly().no().
// bug( "testEveryChannelWriteUpdatesLastModifiedTime", os.isWindows() ).
// bug( "testReadAttributesViewFutureExistingFile" ).
// bug( "testMoveLinkDoesNotChangeLastModifiedTime" ).
// bug( "testMoveWhileWriting" ).
// build();
}
}