📄 msystemutil.java
字号:
package net.jumperz.util;
import java.util.*;
import java.io.*;
import java.net.*;
public class MSystemUtil
{
//--------------------------------------------------------------------------------
public static String createDir( String dirName )
throws IOException
{
File dir = new File( dirName );
if( dir.exists() )
{
if( !dir.isDirectory() )
{
throw new IOException( "Couldn't make directory: " + dir.getCanonicalPath() );
}
}
else
{
if( !dir.mkdir() )
{
throw new IOException( "Couldn't make directory: " + dir.getCanonicalPath() );
}
}
return dir.getCanonicalPath();
}
//--------------------------------------------------------------------------------
public static void sleep( long time )
{
try
{
Thread.sleep( time );
}
catch( InterruptedException e )
{
e.printStackTrace();
}
}
// --------------------------------------------------------------------------------
public static void loadProperties( Properties prop, InputStream in )
throws IOException
{
try
{
prop.load( in );
}
finally
{
in.close();
}
}
// --------------------------------------------------------------------------------
public static void deepCopy( Collection from, Collection to )
{
to.clear();
Iterator p = from.iterator();
while( p.hasNext() )
{
MCloneable o1 = ( MCloneable )p.next();
Object o2 = o1.getClone();
to.add( o2 );
}
}
// --------------------------------------------------------------------------------
public static void closeSocket( Socket s )
{
if( s == null )
{
return;
}
try
{
if( !s.isClosed() )
{
s.close();
}
}
catch( IOException e )
{
}
}
//--------------------------------------------------------------------------------
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -