本文整理汇总了Java中de.schlichtherle.truezip.file.TFileOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java TFileOutputStream类的具体用法?Java TFileOutputStream怎么用?Java TFileOutputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TFileOutputStream类属于de.schlichtherle.truezip.file包,在下文中一共展示了TFileOutputStream类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveModuleDetails
import de.schlichtherle.truezip.file.TFileOutputStream; //导入依赖的package包/类
/**
* Saves the module details to the war in the correct location based on the module id
*
* @param warLocation the war location
* @param moduleDetails the module id
*/
public static void saveModuleDetails(String warLocation, ModuleDetails moduleDetails)
{
// Ensure that it is a valid set of properties
String moduleId = moduleDetails.getId();
try
{
String modulePropertiesFileLocation = getModulePropertiesFileLocation(warLocation, moduleId);
TFile file = new TFile(modulePropertiesFileLocation);
if (file.exists() == false)
{
file.createNewFile();
}
// Get all the module properties
Properties moduleProperties = moduleDetails.getProperties();
OutputStream os = new TFileOutputStream(file);
try
{
moduleProperties.store(os, null);
}
finally
{
os.close();
}
}
catch (IOException exception)
{
throw new ModuleManagementToolException(
"Unable to save module details into WAR file: \n" +
" Module: " + moduleDetails.getId() + "\n" +
" Properties: " + moduleDetails.getProperties(),
exception);
}
}
示例2: copyFile
import de.schlichtherle.truezip.file.TFileOutputStream; //导入依赖的package包/类
private void copyFile(final InputStream sourceFile, TFile targetFile) {
try (InputStream is = sourceFile; OutputStream os = new TFileOutputStream(targetFile)) {
OverthereUtils.write(is, os);
} catch (IOException e) {
throw new RuntimeIOException(e);
}
}