/** * Convenience method. */ public String serialize(Syntax syntax) throws SyntaxNotSupportedException { StringWriter sw = new StringWriter(); try { this.writeTo(sw, syntax); } catch (IOException e) { throw new ModelRuntimeException(e); } return sw.getBuffer().toString(); }
/** * Convenience method. */ @Override public String serialize(Syntax syntax) throws SyntaxNotSupportedException { StringWriter sw = new StringWriter(); try { this.writeTo(sw, syntax); } catch(IOException e) { throw new ModelRuntimeException(e); } return sw.getBuffer().toString(); }
/** * Throws an exception if the syntax is not known */ @Override public void writeTo(OutputStream out, Syntax syntax) throws IOException, ModelRuntimeException { assertModel(); if(syntax == Syntax.RdfXml) { writeTo(out); } else { throw new ModelRuntimeException("Unsupported syntax: " + syntax); } }
/** * Throws an exception if the syntax is not known */ public void writeTo(OutputStream out, Syntax syntax) throws IOException, ModelRuntimeException { assertModel(); if (syntax == Syntax.RdfXml) { writeTo(out); } else { throw new ModelRuntimeException("Unsupported syntax: " + syntax); } }