Package org.apache.abdera.writer

Examples of org.apache.abdera.writer.Writer


    Writer writer = this.getFactory().getAbdera().getWriter();
    writeTo(writer,new OutputStreamWriter(out,charset));
  }

  public void writeTo(java.io.Writer writer) throws IOException {
    Writer out = getFactory().getAbdera().getWriter();
    if (!(out instanceof FOMWriter)) {
      out.writeTo(this,writer);
    } else {
      try {
        OMOutputFormat outputFormat = new OMOutputFormat();
        if (getDocument() != null && getDocument().getCharset() != null)
          outputFormat.setCharSetEncoding(getDocument().getCharset());
View Full Code Here


    res.release();
  }

  protected void prettyPrint(Abdera abdera, Base doc) throws IOException {
     WriterFactory factory = abdera.getWriterFactory();
     Writer writer = factory.getWriter("prettyxml");
     writer.writeTo(doc, System.out);
     System.out.println();
  }
View Full Code Here

      Abdera abdera = new Abdera();
        Entry entry = abdera.newEntry();

        entry.setContent(new IRI("http://example.org/xml"), "text/xml");

        Writer json = abdera.getWriterFactory().getWriter("json");
        entry.writeTo(json, System.out);
    }
View Full Code Here

    server.stop();
  }

  protected void prettyPrint(Base doc) throws IOException {
    WriterFactory factory = abdera.getWriterFactory();
    Writer writer = factory.getWriter("prettyxml");
    writer.writeTo(doc, System.out);
    System.out.println();
  }
View Full Code Here

    }

    /** Pretty print the document body. */
    public static void prettyPrint(Abdera abdera, Base doc) throws IOException {
        WriterFactory factory = abdera.getWriterFactory();
        Writer writer = factory.getWriter("prettyxml");
        writer.writeTo(doc, System.out);
        System.out.println();
    }
View Full Code Here

    entry.setTitle("test");
    entry.setContentAsHtml("<b>foo</b>");
    entry.addAuthor("James");
    entry.addCategory("term");
   
    Writer w = abdera.getWriterFactory().getWriter("json");
    entry.writeTo(w, System.out);
   
    /**
     * Produces:
     *
 
View Full Code Here

            reportError("Atom element can not be serialized", ex);
        }
    }
   
    private void writeAtomElement(Element atomElement, OutputStream os) throws IOException {
        Writer w = formattedOutput ? createWriter("prettyxml") : null;
        if (w != null) {
            atomElement.writeTo(w, os);
        } else {
            atomElement.writeTo(os);
        }
View Full Code Here

            reportError("Atom element can not be serialized", ex);
        }
    }
   
    private void writeAtomElement(Element atomElement, OutputStream os) throws IOException {
        Writer w = formattedOutput ? createWriter("prettyxml") : null;
        if (w != null) {
            atomElement.writeTo(w, os);
        } else {
            atomElement.writeTo(os);
        }
View Full Code Here

    public void writeTo(T element, Class<?> clazz, Type type, Annotation[] a,
                        MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os)
        throws IOException {
        if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mt)) {
            Writer w = createWriter("json");
            if (w == null) {
                throw new WebApplicationException(415);
            }
            element.writeTo(w, os);  
        } else if (formattedOutput) {
            Writer w = createWriter("prettyxml");
            if (w != null) {
                element.writeTo(w, os);
            } else {
                element.writeTo(os);
            }
View Full Code Here

            element.writeTo(os);
        }
    }

    protected Writer createWriter(String writerName) {
        Writer w = ATOM_ENGINE.getWriterFactory().getWriter(writerName);
        if (w == null) {
            LOG.fine("Atom writer \"" + writerName + "\" is not available");
        }
        return w;
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.writer.Writer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.