/** *Thisclassteststoseeifthepropertiesobjectsaves *leadingspaceinthevalueofapropertyasitshould *doaccordingtotheJLS
*/ publicclass Save {
publicstaticvoid main(String argv[]) { int testSucceeded=0;
FileOutputStream myOutput;
// create a properties object to save
Properties myProperties = new Properties();
String value = " spacesfirst";
myProperties.put("atest", value);
try { // save the object and check output
myOutput = new FileOutputStream("testout");
myProperties.store(myOutput,"A test");
myOutput.close();
//load the properties set
FileInputStream myIn = new FileInputStream("testout");
Properties myNewProps = new Properties(); try {
myNewProps.load(myIn);
} finally {
myIn.close();
}
//check the results
String newValue = (String) myNewProps.get("atest"); if (!newValue.equals(value)) thrownew RuntimeException( "Properties does not save leading spaces in values correctly.");
} catch (IOException e) { //do nothing
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.