use of org.gephi.io.importer.spi.FileImporter in project gephi by gephi.
the class DesktopImportControllerUI method importStream.
@Override
public void importStream(final InputStream stream, String importerName) {
final FileImporter importer = controller.getFileImporter(importerName);
if (importer == null) {
NotifyDescriptor.Message msg = new NotifyDescriptor.Message(NbBundle.getMessage(getClass(), "DesktopImportControllerUI.error_no_matching_file_importer"), NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(msg);
return;
}
try {
Reader reader = ImportUtils.getTextReader(stream);
importFile(reader, importer);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
use of org.gephi.io.importer.spi.FileImporter in project gephi by gephi.
the class ImportControllerImpl method getFileImporter.
@Override
public FileImporter getFileImporter(FileObject fileObject) {
if (fileObject != null) {
// Unzip and return content file
fileObject = ImportUtils.getArchivedFile(fileObject);
FileImporterBuilder builder = getMatchingImporter(fileObject);
if (fileObject != null && builder != null) {
FileImporter fi = builder.buildImporter();
return fi;
}
}
return null;
}
Aggregations