Examples of CSVSerializer


Examples of org.apache.pivot.serialization.CSVSerializer

    private volatile boolean abort = false;

    private static final String BASE_PATH_KEY = "basePath";

    public LargeData() {
        csvSerializer = new CSVSerializer("ISO-8859-1");
        csvSerializer.getKeys().add("c0");
        csvSerializer.getKeys().add("c1");
        csvSerializer.getKeys().add("c2");
        csvSerializer.getKeys().add("c3");
    }
View Full Code Here

Examples of org.apache.pivot.serialization.CSVSerializer

                InputStream inputStream = null;

                try {
                    inputStream = fileURL.openStream();

                    CSVSerializer csvSerializer = new CSVSerializer("ISO-8859-1");
                    csvSerializer.getKeys().add("c0");
                    csvSerializer.getKeys().add("c1");
                    csvSerializer.getKeys().add("c2");
                    csvSerializer.getKeys().add("c3");

                    CSVSerializer.StreamIterator streamIterator = csvSerializer.getStreamIterator(inputStream);

                    ArrayList<Object> page = new ArrayList<Object>(pageSize);
                    while (streamIterator.hasNext()
                        && !abort) {
                        Object item = streamIterator.next();
View Full Code Here

Examples of org.apache.wink.common.model.csv.CsvSerializer

     * @throws Exception
     */
    public void testTo() throws Exception {
        // CollectionResource<String> resource = new
        // CollectionResource<String>();
        CsvSerializer csvSerializer = new CsvSerializer() {

            List<String[]> csvText =
                                       new ArrayList<String[]>(
                                                               Arrays
                                                                   .asList(new String[] {"Id",
                                                                               "Name",
                                                                               "Description",
                                                                               "Assigned To",
                                                                               "Severity", "Status"},
                                                                           new String[] {
                                                                               "2",
                                                                               "Infinite Loop",
                                                                               "\"When making target which depends on it self, the application freezes in an infinite loop\"",
                                                                               "developer2",
                                                                               "2-high", "New"},
                                                                           new String[] {
                                                                               "3",
                                                                               "RSS feed component throws exception",
                                                                               "When I open the policy manager home page" + lineSeparator
                                                                                   + " (after I create business policy and perform some validations) I see the error.",
                                                                               "developer3",
                                                                               "4-minor", "New"},
                                                                           new String[] {
                                                                               "1",
                                                                               "Localization problem",
                                                                               "While running the application," + lineSeparator
                                                                                   + "an exception that localization key is not found was thrown.",
                                                                               "developer,1",
                                                                               "2-high", "New"}));

            public Iterator<String[]> getEntities() {
                return csvText.iterator();
            }
        };

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        MultivaluedMapImpl<String, Object> httpHeaders = new MultivaluedMapImpl<String, Object>();
        new CsvSerializerProvider().writeTo(csvSerializer,
                                            csvSerializer.getClass(),
                                            null,
                                            null,
                                            MediaTypeUtils.CSV,
                                            httpHeaders,
                                            os);
View Full Code Here

Examples of org.apache.wink.common.model.csv.CsvSerializer

     * @throws Exception
     */
    public void testTo() throws Exception {
        // CollectionResource<String> resource = new
        // CollectionResource<String>();
        CsvSerializer csvSerializer = new CsvSerializer() {

            List<String[]> csvText =
                                       new ArrayList<String[]>(
                                                               Arrays
                                                                   .asList(new String[] {"Id",
                                                                               "Name",
                                                                               "Description",
                                                                               "Assigned To",
                                                                               "Severity", "Status"},
                                                                           new String[] {
                                                                               "2",
                                                                               "Infinite Loop",
                                                                               "\"When making target which depends on it self, the application freezes in an infinite loop\"",
                                                                               "developer2",
                                                                               "2-high", "New"},
                                                                           new String[] {
                                                                               "3",
                                                                               "RSS feed component throws exception",
                                                                               "When I open the policy manager home page" + lineSeparator
                                                                                   + " (after I create business policy and perform some validations) I see the error.",
                                                                               "developer3",
                                                                               "4-minor", "New"},
                                                                           new String[] {
                                                                               "1",
                                                                               "Localization problem",
                                                                               "While running the application," + lineSeparator
                                                                                   + "an exception that localization key is not found was thrown.",
                                                                               "developer,1",
                                                                               "2-high", "New"}));

            public Iterator<String[]> getEntities() {
                return csvText.iterator();
            }
        };

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        MultivaluedMapImpl<String, Object> httpHeaders = new MultivaluedMapImpl<String, Object>();
        new CsvSerializerProvider().writeTo(csvSerializer,
                                            csvSerializer.getClass(),
                                            null,
                                            null,
                                            MediaTypeUtils.CSV,
                                            httpHeaders,
                                            os);
View Full Code Here

Examples of org.apache.wink.common.model.csv.CsvSerializer

     * @throws Exception
     */
    public void testTo() throws Exception {
        // CollectionResource<String> resource = new
        // CollectionResource<String>();
        CsvSerializer csvSerializer = new CsvSerializer() {

            List<String[]> csvText =
                                       new ArrayList<String[]>(
                                                               Arrays
                                                                   .asList(new String[] {"Id",
                                                                               "Name",
                                                                               "Description",
                                                                               "Assigned To",
                                                                               "Severity", "Status"},
                                                                           new String[] {
                                                                               "2",
                                                                               "Infinite Loop",
                                                                               "\"When making target which depends on it self, the application freezes in an infinite loop\"",
                                                                               "developer2",
                                                                               "2-high", "New"},
                                                                           new String[] {
                                                                               "3",
                                                                               "RSS feed component throws exception",
                                                                               "When I open the policy manager home page" + lineSeparator
                                                                                   + " (after I create business policy and perform some validations) I see the error.",
                                                                               "developer3",
                                                                               "4-minor", "New"},
                                                                           new String[] {
                                                                               "1",
                                                                               "Localization problem",
                                                                               "While running the application," + lineSeparator
                                                                                   + "an exception that localization key is not found was thrown.",
                                                                               "developer,1",
                                                                               "2-high", "New"}));

            public Iterator<String[]> getEntities() {
                return csvText.iterator();
            }
        };

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        MultivaluedMapImpl<String, Object> httpHeaders = new MultivaluedMapImpl<String, Object>();
        new CsvSerializerProvider().writeTo(csvSerializer,
                                            csvSerializer.getClass(),
                                            null,
                                            null,
                                            MediaTypeUtils.CSV_TYPE,
                                            httpHeaders,
                                            os);
View Full Code Here

Examples of pivot.serialization.CSVSerializer

    private static final String BASE_PATH_KEY = "basePath";
    private static final int PAGE_SIZE = 100;

    public LargeData() {
        csvSerializer = new CSVSerializer("ISO-8859-1");
        csvSerializer.getKeys().add("c0");
        csvSerializer.getKeys().add("c1");
        csvSerializer.getKeys().add("c2");
        csvSerializer.getKeys().add("c3");
    }
View Full Code Here

Examples of pivot.serialization.CSVSerializer

                InputStream inputStream = null;

                try {
                    inputStream = fileURL.openStream();

                    CSVSerializer csvSerializer = new CSVSerializer("ISO-8859-1");
                    csvSerializer.getKeys().add("c0");
                    csvSerializer.getKeys().add("c1");
                    csvSerializer.getKeys().add("c2");
                    csvSerializer.getKeys().add("c3");

                    CSVSerializer.StreamIterator streamIterator = csvSerializer.getStreamIterator(inputStream);

                    ArrayList<Object> page = new ArrayList<Object>(PAGE_SIZE);
                    while (streamIterator.hasNext()
                        && !abort) {
                        Object item = streamIterator.next();
View Full Code Here

Examples of pivot.serialization.CSVSerializer

        "hello,world",
        "2,4,6,8,10"
    };

    public static void main(String[] args) {
        CSVSerializer csvSerializer = new CSVSerializer();
        csvSerializer.getKeys().add("A");
        csvSerializer.getKeys().add("B");
        csvSerializer.getKeys().add("C");
        csvSerializer.getKeys().add("D");

        for (int i = 0, n = testStrings.length; i < n; i++) {
            try {
                System.out.println("Input: " + testStrings[i]);
                List<?> objects = csvSerializer.readObject(new StringReader(testStrings[i]));

                StringWriter writer = new StringWriter();
                csvSerializer.writeObject(objects, writer);
                System.out.println("Output: " + writer);
            } catch(Exception exception) {
                System.out.println(exception);
            }
        }
View Full Code Here

Examples of pivot.serialization.CSVSerializer

        // v - volume
        String symbolsArgument = symbolsArgumentBuilder.toString();
        getQuery.getParameters().put("s", symbolsArgument);
        getQuery.getParameters().put("f", "snl1ohgc1v");

        CSVSerializer quoteSerializer = new CSVSerializer();
        quoteSerializer.getKeys().add("symbol");
        quoteSerializer.getKeys().add("companyName");
        quoteSerializer.getKeys().add("value");
        quoteSerializer.getKeys().add("openingValue");
        quoteSerializer.getKeys().add("highValue");
        quoteSerializer.getKeys().add("lowValue");
        quoteSerializer.getKeys().add("change");
        quoteSerializer.getKeys().add("volume");

        quoteSerializer.setItemClass(StockQuote.class);
        getQuery.setSerializer(quoteSerializer);

        getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
            public void taskExecuted(Task<Object> task) {
                if (task == getQuery) {
View Full Code Here

Examples of pivot.serialization.CSVSerializer

        // v - volume
        String symbolsArgument = symbolsArgumentBuilder.toString();
        getQuery.getArguments().put("s", symbolsArgument);
        getQuery.getArguments().put("f", "snl1ohgc1v");

        CSVSerializer quoteSerializer = new CSVSerializer();
        quoteSerializer.getKeys().add("symbol");
        quoteSerializer.getKeys().add("companyName");
        quoteSerializer.getKeys().add("value");
        quoteSerializer.getKeys().add("openingValue");
        quoteSerializer.getKeys().add("highValue");
        quoteSerializer.getKeys().add("lowValue");
        quoteSerializer.getKeys().add("change");
        quoteSerializer.getKeys().add("volume");

        quoteSerializer.setItemClass(StockQuote.class);
        getQuery.setSerializer(quoteSerializer);

        getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>() {
            public void taskExecuted(Task<Object> task) {
                if (task == getQuery) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.