當前位置: 首頁>>代碼示例>>Java>>正文


Java Serializer.read方法代碼示例

本文整理匯總了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();
}
 
開發者ID:nicholasrout,項目名稱:shortstories,代碼行數:23,代碼來源:ChoiceActivity.java

示例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;
    }
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:27,代碼來源:NotificationConfigurator.java

示例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;
     }
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:22,代碼來源:RecursoPersistenciaEntornosSimulacionImp1.java

示例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;
     }
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:22,代碼來源:RecursoPersistenciaEntornosSimulacionImp1.java

示例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;
     }
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:19,代碼來源:PersistenciaVisualizadorEscenarios.java

示例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");
}
 
開發者ID:adleritech,項目名稱:flexibee,代碼行數:20,代碼來源:InternalDocumentTest.java

示例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;
}
 
開發者ID:brandall76,項目名稱:Saiy-PS,代碼行數:22,代碼來源:ResolveWolframAlpha.java

示例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;
}
 
開發者ID:PacktPublishing,項目名稱:Asynchronous-Android-Programming,代碼行數:17,代碼來源:XMLConverter.java

示例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;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:17,代碼來源:Persist.java

示例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;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:17,代碼來源:TestUtils.java

示例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;
  }
 
開發者ID:c2mon,項目名稱:c2mon,代碼行數:19,代碼來源:TagConfigImpl.java

示例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;
  }
 
開發者ID:c2mon,項目名稱:c2mon,代碼行數:19,代碼來源:AlarmValueImpl.java

示例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;
  }
 
開發者ID:c2mon,項目名稱:c2mon,代碼行數:19,代碼來源:CommandTagImpl.java

示例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;
}
 
開發者ID:c2mon,項目名稱:c2mon,代碼行數:22,代碼來源:ConfigurationLoaderImpl.java

示例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;
}
 
開發者ID:aroog,項目名稱:code,代碼行數:20,代碼來源:DefaultingPersist.java


注:本文中的org.simpleframework.xml.Serializer.read方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。