JmeExporter: remove useless return
This commit is contained in:
parent
17bf0f8ab3
commit
b4baaadc79
@ -46,22 +46,18 @@ public interface JmeExporter {
|
||||
*
|
||||
* @param object The savable to export
|
||||
* @param f The output stream
|
||||
* @return Always returns true. If an error occurs during export,
|
||||
* an exception is thrown
|
||||
* @throws IOException If an io exception occurs during export
|
||||
*/
|
||||
public boolean save(Savable object, OutputStream f) throws IOException;
|
||||
public void save(Savable object, OutputStream f) throws IOException;
|
||||
|
||||
/**
|
||||
* Export the {@link Savable} to a file.
|
||||
*
|
||||
* @param object The savable to export
|
||||
* @param f The file to export to
|
||||
* @return Always returns true. If an error occurs during export,
|
||||
* an exception is thrown
|
||||
* @throws IOException If an io exception occurs during export
|
||||
*/
|
||||
public boolean save(Savable object, File f) throws IOException;
|
||||
public void save(Savable object, File f) throws IOException;
|
||||
|
||||
/**
|
||||
* Returns the {@link OutputCapsule} for the given savable object.
|
||||
|
@ -168,7 +168,7 @@ public class BinaryExporter implements JmeExporter {
|
||||
return new BinaryExporter();
|
||||
}
|
||||
|
||||
public boolean save(Savable object, OutputStream os) throws IOException {
|
||||
public void save(Savable object, OutputStream os) throws IOException {
|
||||
// reset some vars
|
||||
aliasCount = 1;
|
||||
idCount = 1;
|
||||
@ -294,8 +294,6 @@ public class BinaryExporter implements JmeExporter {
|
||||
logger.log(Level.FINE, "location table: {0} bytes", locationTableSize);
|
||||
logger.log(Level.FINE, "data: {0} bytes", location);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getChunk(BinaryIdContentPair pair) {
|
||||
@ -325,7 +323,7 @@ public class BinaryExporter implements JmeExporter {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public boolean save(Savable object, File f) throws IOException {
|
||||
public void save(Savable object, File f) throws IOException {
|
||||
File parentDirectory = f.getParentFile();
|
||||
if (parentDirectory != null && !parentDirectory.exists()) {
|
||||
parentDirectory.mkdirs();
|
||||
@ -333,13 +331,11 @@ public class BinaryExporter implements JmeExporter {
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
try {
|
||||
return save(object, fos);
|
||||
save(object, fos);
|
||||
} finally {
|
||||
if (fos != null) {
|
||||
fos.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BinaryOutputCapsule getCapsule(Savable object) {
|
||||
return contentTable.get(object).getContent();
|
||||
|
@ -40,6 +40,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
/**
|
||||
* Part of the jME XML IO system as introduced in the google code jmexml project.
|
||||
@ -61,7 +62,8 @@ public class XMLExporter implements JmeExporter {
|
||||
|
||||
}
|
||||
|
||||
public boolean save(Savable object, OutputStream f) throws IOException {
|
||||
@Override
|
||||
public void save(Savable object, OutputStream f) throws IOException {
|
||||
try {
|
||||
//Initialize Document when saving so we don't retain state of previous exports
|
||||
this.domOut = new DOMOutputCapsule(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(), this);
|
||||
@ -69,18 +71,22 @@ public class XMLExporter implements JmeExporter {
|
||||
DOMSerializer serializer = new DOMSerializer();
|
||||
serializer.serialize(domOut.getDoc(), f);
|
||||
f.flush();
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
IOException e = new IOException();
|
||||
e.initCause(ex);
|
||||
throw e;
|
||||
} catch (ParserConfigurationException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean save(Savable object, File f) throws IOException {
|
||||
return save(object, new FileOutputStream(f));
|
||||
@Override
|
||||
public void save(Savable object, File f) throws IOException {
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
try {
|
||||
save(object, fos);
|
||||
} finally {
|
||||
fos.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputCapsule getCapsule(Savable object) {
|
||||
return domOut;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user