本文整理了Java中net.roboconf.core.utils.Utils.readFileContentQuietly()
方法的一些代码示例,展示了Utils.readFileContentQuietly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.readFileContentQuietly()
方法的具体详情如下:
包路径:net.roboconf.core.utils.Utils
类名称:Utils
方法名:readFileContentQuietly
[英]Reads a text file content and returns it as a string.
The file is tried to be read with UTF-8 encoding. If it fails, the default system encoding is used.
[中]读取文本文件内容并将其作为字符串返回。
尝试使用UTF-8编码读取该文件。如果失败,则使用默认的系统编码。
代码示例来源:origin: net.roboconf/roboconf-dm
@Override
public TargetProperties findTargetProperties( String targetId ) {
File file = findTargetFile( targetId, Constants.TARGET_PROPERTIES_FILE_NAME );
String content = Utils.readFileContentQuietly( file, this.logger );
Map<String,String> map = new HashMap<> ();
for( Map.Entry<Object,Object> entry : Utils.readPropertiesQuietly( content, this.logger ).entrySet()) {
map.put((String) entry.getKey(), (String) entry.getValue());
}
return new TargetPropertiesImpl( map, content, file );
}
代码示例来源:origin: roboconf/roboconf-platform
@Test
public void testReadFileContentQuietly_nullFile() throws Exception {
String readS = Utils.readFileContentQuietly( null, Logger.getLogger( getClass().getName()));
Assert.assertEquals( "", readS );
}
代码示例来源:origin: roboconf/roboconf-platform
@Test
public void testReadFileContentQuietly_inexistingFile() throws Exception {
String readS = Utils.readFileContentQuietly( new File( "inexisting" ), Logger.getLogger( getClass().getName()));
Assert.assertEquals( "", readS );
}
代码示例来源:origin: roboconf/roboconf-platform
@Test
public void testReadFileContentQuietly_exception() throws Exception {
File output = this.folder.newFolder();
String readS = Utils.readFileContentQuietly( output, Logger.getLogger( getClass().getName()));
Assert.assertEquals( "", readS );
}
代码示例来源:origin: roboconf/roboconf-platform
@Test
public void testReadFileContentQuietly() throws Exception {
String s = "this is\na\test\t";
File output = this.folder.newFile();
Utils.writeStringInto( s, output );
String readS = Utils.readFileContentQuietly( output, Logger.getLogger( getClass().getName()));
Assert.assertEquals( s, readS );
}
内容来源于网络,如有侵权,请联系作者删除!