本文整理汇总了Java中javax.jnlp.FileSaveService类的典型用法代码示例。如果您正苦于以下问题:Java FileSaveService类的具体用法?Java FileSaveService怎么用?Java FileSaveService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileSaveService类属于javax.jnlp包,在下文中一共展示了FileSaveService类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: save
import javax.jnlp.FileSaveService; //导入依赖的package包/类
/**
* Saves an input stream to a file.
*
* @param is
* @param fileName
* @return Boolean
* @throws FileChooserException
*/
public boolean save(InputStream is, String fileName) throws FileChooserException {
try {
FileSaveService fss = (FileSaveService) ServiceManager.lookup(FileSaveService.class.getName());
FileContents fc = fss.saveFileDialog(getUserDirectory(), null, is, fileName);
if (fc != null) {
logger.info("Saved: " + fc.getName());
return true;
} else {
return false;
}
} catch (Exception e) {
String message = "Failed save: " + e.getMessage();
logger.warning(message);
throw new FileChooserException(message);
}
}
开发者ID:YcheCourseProject,项目名称:DIA-Umpire-Maven,代码行数:25,代码来源:FileChooserJNLP.java
示例2: save
import javax.jnlp.FileSaveService; //导入依赖的package包/类
/**
* Saves an input stream to a file.
*
* @param is
* @param fileName
* @return Boolean
* @throws FileChooserException
*/
public boolean save(InputStream is, String fileName) throws FileChooserException {
try {
FileSaveService fss = (FileSaveService) ServiceManager.lookup(FileSaveService.class.getName());
FileContents fc = fss.saveFileDialog(getUserDirectory(), null, is, fileName);
if (fc != null) {
logger.info("Saved: " + fc.getName());
return true;
} else {
return false;
}
} catch (Exception e) {
String message = "Failed save: " + e.getMessage();
logger.warning(message);
throw new FileChooserException(message);
}
}
开发者ID:ahmedmoustafa,项目名称:JAligner,代码行数:25,代码来源:FileChooserJNLP.java
示例3: init
import javax.jnlp.FileSaveService; //导入依赖的package包/类
public boolean init() {
if (!super.init()) return false;
try {
fss = (FileSaveService)
ServiceManager.lookup(FileSaveService.class.getName());
return true;
}
catch (UnavailableServiceException e) {
Object[] args = {
prevExn.getLocalizedMessage(),
e.getLocalizedMessage(),
prevExn.toString(),
e.toString()
};
JOptionPane.showMessageDialog
(main, I18n._("File save service unavailable", args),
I18n._("Export"), JOptionPane.ERROR_MESSAGE);
return false;
}
}
开发者ID:IMAGINARY,项目名称:morenaments-euc,代码行数:21,代码来源:ServiceExportMechanism.java
示例4: save
import javax.jnlp.FileSaveService; //导入依赖的package包/类
private void save() throws IOException {
FileSaveService fos = null;
try {
fos = PhetServiceManager.getFileSaveService( module.getSimulationPanel() );
}
catch( UnavailableServiceException e ) {
e.printStackTrace();
}
XMLElement xml = CircuitXML.toXML( module.getCircuit() );
StringWriter sw = new StringWriter();
XMLWriter writer = new XMLWriter( sw );
writer.write( xml );
String circuitxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + sw.toString();
InputStream stream = new ByteArrayInputStream( circuitxml.getBytes() );
FileContents data = new InputStreamFileContents( "circuitxml", stream );
FileContents out = fos.saveFileDialog( null, null, data.getInputStream(), null );
if ( out != null ) {
System.out.println( "Saved to " + out.getName() + " as: " + out );
}
}
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:CCKControlPanel.java
示例5: save
import javax.jnlp.FileSaveService; //导入依赖的package包/类
public static void save( AbstractEnergySkateParkModule module ) throws UnavailableServiceException, IOException {
Component component = module.getEnergySkateParkSimulationPanel();
String xml = toXMLString( module );
EnergySkateParkLogging.println( "xml = " + xml );
InputStream stream = new ByteArrayInputStream( xml.getBytes() );
FileContents data = new InputStreamFileContents( "esp_output", stream );
FileSaveService fos = PhetServiceManager.getFileSaveService( component );
FileContents out = fos.saveAsFileDialog( null, null, data );
EnergySkateParkLogging.println( "Saved file." );
}
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:EnergySkateParkIO.java
示例6: getFileSaveService
import javax.jnlp.FileSaveService; //导入依赖的package包/类
public static FileSaveService getFileSaveService( Component owner ) throws UnavailableServiceException {
if ( isJavaWebStart() ) {
return (FileSaveService) ServiceManager.lookup( "javax.jnlp.FileSaveService" );
}
return new LocalFileSaveService( owner );
}
开发者ID:mleoking,项目名称:PhET,代码行数:7,代码来源:PhetServiceManager.java
示例7: getFileSaveService
import javax.jnlp.FileSaveService; //导入依赖的package包/类
/**
* @return the FileSaveService reference, or null if the service is
* unavailable.
*/
public static FileSaveService getFileSaveService() {
return (FileSaveService) getService("javax.jnlp.FileSaveService");
}
开发者ID:GITNE,项目名称:icedtea-web,代码行数:8,代码来源:ServiceUtil.java
注:本文中的javax.jnlp.FileSaveService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论