public Content newContent(Type type) { if (type == null) type = Content.Type.TEXT; return newContent(type, null); }
public Content newContent() { return newContent(Content.Type.TEXT); }
public Content newContent(MimeType mediaType) { return newContent(mediaType, null); }
/** * Sets the content for this entry */ public Content setContent(Element value) { FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(); content.setValueElement(value); setContentElement(content); return content; }
/** * Sets the content for this entry */ public Content setContent(String value, Content.Type type) { FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(type); content.setValue(value); setContentElement(content); return content; }
/** * Sets the content for this entry as @type="text" */ public Content setContent(String value) { complete(); FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(); content.setValue(value); setContentElement(content); return content; }
public Content newContent(MimeType mediaType, Element parent) { Content.Type type = (MimeTypeHelper.isXml(mediaType.toString())) ? Content.Type.XML : Content.Type.MEDIA; Content content = newContent(type, parent); content.setMimeType(mediaType.toString()); return content; }
/** * Sets the content for this entry * * @throws MimeTypeParseException */ public Content setContent(Element element, String mediaType) { try { if (MimeTypeHelper.isText(mediaType)) throw new IllegalArgumentException(); FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(new MimeType(mediaType)); content.setValueElement(element); setContentElement(content); return content; } catch (javax.activation.MimeTypeParseException e) { throw new org.apache.abdera.util.MimeTypeParseException(e); } }
/** * Sets the content for this entry * * @throws MimeTypeParseException */ public Content setContent(String value, String mediatype) { try { FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(new MimeType(mediatype)); content.setValue(value); content.setMimeType(mediatype); setContentElement(content); return content; } catch (javax.activation.MimeTypeParseException e) { throw new org.apache.abdera.util.MimeTypeParseException(e); } }
/** * Sets the content for this entry * * @throws MimeTypeParseException */ public Content setContent(DataHandler dataHandler, String mediatype) { if (MimeTypeHelper.isText(mediatype)) { try { return setContent(dataHandler.getInputStream(), mediatype); } catch (IOException e) { throw new RuntimeException(e); } } else { FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(Content.Type.MEDIA); content.setDataHandler(dataHandler); if (mediatype != null) content.setMimeType(mediatype); setContentElement(content); return content; } }
/** * Sets the content for this entry * * @throws MimeTypeParseException * @throws IRISyntaxException */ public Content setContent(IRI uri, String mediatype) { try { FOMFactory factory = (FOMFactory)this.factory; Content content = factory.newContent(new MimeType(mediatype)); content.setSrc(uri.toString()); setContentElement(content); return content; } catch (javax.activation.MimeTypeParseException e) { throw new org.apache.abdera.util.MimeTypeParseException(e); } }