本文整理匯總了Java中org.simpleframework.xml.Serializer.read方法的典型用法代碼示例。如果您正苦於以下問題:Java Serializer.read方法的具體用法?Java Serializer.read怎麽用?Java Serializer.read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.simpleframework.xml.Serializer
的用法示例。
在下文中一共展示了Serializer.read方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: performPreFinishOperations
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
@Override
protected void performPreFinishOperations() {
Serializer serializer = new Persister();
String choiceXml = getIntent().getExtras().getString(IntentUtil.EXTRA_CHOICE_XML);
try {
mChoice = serializer.read(Choice.class, choiceXml);
} catch (Exception e) {
Log.d(TAG, e.toString());
return;
}
Settings settings = new Settings(this);
mNotificationPriority = settings.notificationPriority();
mGoHomeNewScenario = settings.goHomeNewScenario();
mExpandNotificationsNewScenario = settings.expandNotificationsNewScenario();
setAchievements();
maybeAdjustProgress();
showScenarioNotification();
disableExistingShortcuts();
addChoiceShortcuts();
goHomeToHideShortcuts();
expandNotificationsPanelDelayed();
}
示例2: init
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public void init() {
InputStream is = this.getClass().getResourceAsStream("/notification.config.xml");
if (is == null) {
logger.warn("Notification config file not found!");
return;
}
Serializer serializer = new Persister();
try {
this.ruleList = serializer.read(NotificationRuleList.class, is);
is.close();
} catch (Exception e) {
logger.error("Read configuration file error!");
e.printStackTrace();
}
if (ruleList != null && ruleList.getRules() != null) {
ruleMap = new HashMap<>();
for (NotificationRule rule : ruleList.getRules()) {
EventSource source = rule.getSource();
if (!ruleMap.containsKey(source)) {
ruleMap.put(source, new ArrayList<>());
}
ruleMap.get(source).add(rule);
}
configured = true;
}
}
示例3: obtenerInfoEscenarioSimulacion
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public EscenarioSimulacionRobtsVictms obtenerInfoEscenarioSimulacion(String identFicheroInfoPersistencia){
try {
File ficheroEscenario = this.obtenerFicheroEscenario(identFicheroInfoPersistencia);
if(ficheroEscenario== null){
// dirFicherosPersistencia.mkdir();
// rutaFicheroInfoPersistencia= dirFicherosPersistencia.getAbsolutePath()+"\\";
System.out.println("El fichero : "+ identFicheroInfoPersistencia+ " No existe " );
}else {
Serializer serializer = new Persister();
// EscenarioSimulacionRobtsVictms escenario = serializer.read(EscenarioSimulacionRobtsVictms.class,ficheroEscenario, false);
return serializer.read(EscenarioSimulacionRobtsVictms.class,ficheroEscenario, false);
// serializer.read(EscenarioSimulacionRobtsVictms.class,ficheroEscenario, false);
}
}catch (Exception e) { // catches ANY exception
e.printStackTrace();
}
return null;
}
示例4: obtenerInfoCasoSimulacion
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public InfoCasoSimulacion obtenerInfoCasoSimulacion(String identFicheroCaso) {
try {
File ficheroEscenario = this.obtenerFicheroCasoSimulacion(identFicheroCaso);
if(ficheroEscenario== null){
// dirFicherosPersistencia.mkdir();
// rutaFicheroInfoPersistencia= dirFicherosPersistencia.getAbsolutePath()+"\\";
System.out.println("El fichero : "+ identFicheroCaso+ " No existe " );
}else {
Serializer serializer = new Persister();
// EscenarioSimulacionRobtsVictms escenario = serializer.read(EscenarioSimulacionRobtsVictms.class,ficheroEscenario, false);
return serializer.read(InfoCasoSimulacion.class,ficheroEscenario, false);
}
}catch (Exception e) { // catches ANY exception
e.printStackTrace();
}
return null;
}
示例5: obtenerInfoEscenarioSimulacion
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public EscenarioSimulacionRobtsVictms obtenerInfoEscenarioSimulacion(String rutaFicheroInfoPersistencia){
try {
File ficheroEscenario = new File(rutaFicheroInfoPersistencia);
if(!ficheroEscenario.exists()){
// dirFicherosPersistencia.mkdir();
// rutaFicheroInfoPersistencia= dirFicherosPersistencia.getAbsolutePath()+"\\";
System.out.println("El fichero : "+ rutaFicheroInfoPersistencia+ " No existe " );
}else {
Serializer serializer = new Persister();
return serializer.read(EscenarioSimulacionRobtsVictms.class,ficheroEscenario, false);
}
}catch (Exception e) { // catches ANY exception
e.printStackTrace();
}
return null;
}
示例6: parseFromXmlToObject
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
@Test
public void parseFromXmlToObject() throws Exception {
String xml = "<winstrom version=\"1.0\">\n" +
" <interni-doklad>\n" +
" <typDokl>code:ID</typDokl>\n" +
" <datVyst>2011-01-01+01:00</datVyst>\n" +
" <varSym>123</varSym><!-- účet MD -->\n" +
" </interni-doklad>\n" +
"</winstrom>";
Serializer serializer = new Persister(Factory.matchers());
WinstromRequest example = serializer.read(WinstromRequest.class, xml);
assertThat(example.getInternalDocument()).isNotNull();
assertThat(example.getInternalDocument().getIssued()).isEqualTo("2011-01-01");
assertThat(example.getInternalDocument().getVariableSymbol()).isEqualTo("123");
}
示例7: validate
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public boolean validate(@NonNull final String question) {
if (DEBUG) {
MyLog.i(CLS_NAME, "validate");
}
final Serializer serializer = new Persister();
try {
final ValidateQueryResult result = serializer.read(ValidateQueryResult.class, question, false);
return result.passedValidation();
} catch (final Exception e) {
if (DEBUG) {
MyLog.w(CLS_NAME, "Exception");
e.printStackTrace();
}
}
return false;
}
示例8: decode
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
@Override
public POJO decode(Body body) throws Exception {
Serializer serializer = new Persister();
InputStream is =null;
RawBody rawBody = (RawBody)body;
POJO obj = null;
try {
is= new ByteArrayInputStream(rawBody.getContent());
BufferedReader bfReader = new BufferedReader(new InputStreamReader(is));
obj = (POJO) serializer.read(clazz,bfReader);
Log.i("asd", "asd");
} finally {
if(is != null) is.close();
}
return obj;
}
示例9: load
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public static HeuristicsModel load(String filename) {
HeuristicsModel read = null;
Strategy strategy = new CycleStrategy("id", "ref");
Serializer serializer = new Persister(strategy);
File source = new File(filename);
try {
if (source.exists()) {
read = serializer.read(HeuristicsModel.class, source);
}
}
catch (Exception e) {
e.printStackTrace();
}
return read;
}
示例10: load
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public static BaseTraceability load(String filename) {
BaseTraceability read = null;
Strategy strategy = new CycleStrategy("id", "ref");
Serializer serializer = new Persister(strategy);
File source = new File(filename);
try {
read = serializer.read(BaseTraceability.class, source);
}
catch (Exception e) {
System.err.println("Exception when loading file:"+ filename);
e.printStackTrace();
}
return read;
}
示例11: fromXml
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public static TagConfigImpl fromXml(final String xml) throws Exception {
TagConfigImpl conf = null;
StringReader sr = null;
Serializer serializer = new Persister(new AnnotationStrategy());
try {
sr = new StringReader(xml);
conf = serializer.read(TagConfigImpl.class, new StringReader(xml), false);
} finally {
if (sr != null) {
sr.close();
}
}
return conf;
}
示例12: fromXml
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public static AlarmValueImpl fromXml(final String xml) throws Exception {
AlarmValueImpl alarmVal = null;
StringReader sr = null;
Serializer serializer = new Persister(new AnnotationStrategy());
try {
sr = new StringReader(xml);
alarmVal = serializer.read(AlarmValueImpl.class, new StringReader(xml), false);
} finally {
if (sr != null) {
sr.close();
}
}
return alarmVal;
}
示例13: fromXml
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public static CommandTagImpl fromXml(final String xml) throws Exception {
CommandTagImpl commandTag = null;
StringReader sr = null;
Serializer serializer = new Persister(new AnnotationStrategy());
try {
sr = new StringReader(xml);
commandTag = serializer.read(CommandTagImpl.class, new StringReader(xml), false);
} finally {
if (sr != null) {
sr.close();
}
}
return commandTag;
}
示例14: getConfigurationReports
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
@Override
public List<ConfigurationReportHeader> getConfigurationReports() {
List<ConfigurationReportHeader> reports = new ArrayList<>();
// Read all report files and deserialise them
try {
ArrayList<File> files = new ArrayList<>(Arrays.asList(new File(reportDirectory).listFiles(new ConfigurationReportFileFilter())));
Serializer serializer = getSerializer();
for (File file : files) {
ConfigurationReportHeader report = serializer.read(ConfigurationReportHeader.class, file);
log.debug("Deserialised configuration report {}", report.getId());
reports.add(report);
}
} catch (Exception e) {
log.error("Error deserialising configuration report", e);
}
return reports;
}
示例15: load
import org.simpleframework.xml.Serializer; //導入方法依賴的package包/類
public static DefaultingModel load(String filename) {
DefaultingModel read = null;
Strategy strategy = new CycleStrategy("id", "ref");
Serializer serializer = new Persister(strategy);
File source = new File(filename);
try {
read = serializer.read(DefaultingModel.class, source);
if (read != null ) {
read.finish();
}
}
catch (Exception e) {
e.printStackTrace();
}
return read;
}