Skip to content

Commit

Permalink
cleanup IQSS#3700
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Nov 22, 2017
1 parent b00d4d6 commit 2f278cc
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.json.Json;
import javax.json.JsonObject;
Expand All @@ -16,22 +15,23 @@
@AutoService(Exporter.class)
public class SchemaDotOrgExporter implements Exporter {

private static final Logger logger = Logger.getLogger(SchemaDotOrgExporter.class.getCanonicalName());

@Override
public void exportDataset(DatasetVersion version, JsonObject json, OutputStream outputStream) throws ExportException {
// JsonObject json2 = Json.createObjectBuilder().add("foo", "bar").build();
String jsonLdAsString = version.getJsonLd();
StringReader foo = new StringReader(jsonLdAsString);
JsonReader bar = Json.createReader(foo);
JsonObject json2 = bar.readObject();
StringReader stringReader = new StringReader(jsonLdAsString);
JsonReader jsonReader = Json.createReader(stringReader);
JsonObject jsonLdJsonObject = jsonReader.readObject();
try {
outputStream.write(json2.toString().getBytes("UTF8"));
outputStream.write(jsonLdJsonObject.toString().getBytes("UTF8"));
} catch (IOException ex) {
Logger.getLogger(SchemaDotOrgExporter.class.getName()).log(Level.SEVERE, null, ex);
logger.info("IOException calling outputStream.write: " + ex);
}
try {
outputStream.flush();
} catch (IOException ex) {
Logger.getLogger(SchemaDotOrgExporter.class.getName()).log(Level.SEVERE, null, ex);
logger.info("IOException calling outputStream.flush: " + ex);
}
}

Expand Down

0 comments on commit 2f278cc

Please sign in to comment.