Javadoc fix

This commit is contained in:
Doug Pedrick 2012-04-27 22:08:58 +00:00
parent ca52cc6612
commit df7ab36b5a

@ -1,5 +1,13 @@
package net.sf.openrocket.preset.xml; package net.sf.openrocket.preset.xml;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.InvalidComponentPresetException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
@ -8,30 +16,23 @@ import java.io.Reader;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.List; import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import net.sf.openrocket.material.Material;
import net.sf.openrocket.preset.ComponentPreset;
import net.sf.openrocket.preset.InvalidComponentPresetException;
/** /**
* The active manager class that is the entry point for writing *.orc files. * The active manager class that is the entry point for reading and writing *.orc files.
*/ */
public class OpenRocketComponentSaver { public class OpenRocketComponentSaver {
/** /**
* This method marshals an OpenRocketDocument (OR design) to Rocksim-compliant XML. * This method marshals a list of materials and ComponentPresets into an .orc formatted XML string.
* *
* @param theMaterialList the list of materials to be included * @param theMaterialList the list of materials to be included
* @param thePresetList the list of presets to be included * @param thePresetList the list of presets to be included
* *
* @return ORC-compliant XML * @return ORC-compliant XML
*
* @throws JAXBException * @throws JAXBException
*/ */
public String marshalToOpenRocketComponent(List<Material> theMaterialList, List<ComponentPreset> thePresetList) throws JAXBException { public String marshalToOpenRocketComponent(List<Material> theMaterialList, List<ComponentPreset> thePresetList) throws
JAXBException {
JAXBContext binder = JAXBContext.newInstance(OpenRocketComponentDTO.class); JAXBContext binder = JAXBContext.newInstance(OpenRocketComponentDTO.class);
Marshaller marshaller = binder.createMarshaller(); Marshaller marshaller = binder.createMarshaller();
@ -46,15 +47,16 @@ public class OpenRocketComponentSaver {
/** /**
* This method unmarshals from a Reader that is presumed to be open on an XML file in .orc format. * This method unmarshals from a Reader that is presumed to be open on an XML file in .orc format.
* *
* @param is an open reader; StringBufferInputStream could not be used because it's deprecated and does not handle * @param is an open reader; StringBufferInputStream could not be used because it's deprecated and does not handle UTF
* UTF characters correctly * characters correctly
* *
* @return a list of ComponentPresets * @return a list of ComponentPresets
* *
* @throws InvalidComponentPresetException * @throws InvalidComponentPresetException
* *
*/ */
public List<ComponentPreset> unmarshalFromOpenRocketComponent(Reader is) throws JAXBException, InvalidComponentPresetException { public List<ComponentPreset> unmarshalFromOpenRocketComponent(Reader is) throws JAXBException,
InvalidComponentPresetException {
return fromOpenRocketComponent(is).asComponentPresets(); return fromOpenRocketComponent(is).asComponentPresets();
} }
@ -64,10 +66,13 @@ public class OpenRocketComponentSaver {
* @param dest the stream to write the data to * @param dest the stream to write the data to
* @param theMaterialList the list of materials to be included * @param theMaterialList the list of materials to be included
* @param thePresetList the list of presets to be included * @param thePresetList the list of presets to be included
*
* @throws JAXBException * @throws JAXBException
* @throws IOException thrown if the stream could not be written * @throws IOException thrown if the stream could not be written
*/ */
public void save(OutputStream dest, List<Material> theMaterialList, List<ComponentPreset> thePresetList) throws IOException, JAXBException { public void save(OutputStream dest, List<Material> theMaterialList, List<ComponentPreset> thePresetList) throws
IOException,
JAXBException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(dest, "UTF-8")); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(dest, "UTF-8"));
writer.write(marshalToOpenRocketComponent(theMaterialList, thePresetList)); writer.write(marshalToOpenRocketComponent(theMaterialList, thePresetList));
writer.flush(); writer.flush();
@ -79,8 +84,8 @@ public class OpenRocketComponentSaver {
* *
* @param is an open Reader; assumed to be opened on a file of XML in .orc format * @param is an open Reader; assumed to be opened on a file of XML in .orc format
* *
* @return the OpenRocketComponentDTO that is a POJO representation of the XML; null if the data could not be read * @return the OpenRocketComponentDTO that is a POJO representation of the XML; null if the data could not be read or
* or was in an invalid format * was in an invalid format
*/ */
private OpenRocketComponentDTO fromOpenRocketComponent(Reader is) throws JAXBException { private OpenRocketComponentDTO fromOpenRocketComponent(Reader is) throws JAXBException {
JAXBContext bind = JAXBContext.newInstance(OpenRocketComponentDTO.class); JAXBContext bind = JAXBContext.newInstance(OpenRocketComponentDTO.class);