Package com.cedarsoftware.util.io

Examples of com.cedarsoftware.util.io.JsonReader$CollectionFactory


        try
        {
            URL url = NCubeManager.class.getResource("/" + name);
            File arrayJsonCubes = new File(url.getFile());
            FileInputStream in = new FileInputStream(arrayJsonCubes);
            JsonReader reader = new JsonReader(in, true);
            JsonObject ncubes = (JsonObject) reader.readObject();
            Object[] cubes = ncubes.getArray();
            List<NCube> cubeList = new ArrayList<NCube>(cubes.length);

            for (Object cube : cubes)
            {
View Full Code Here


    /**
     * Still used in getNCubesFromResource
     */
    private static JsonObject getJsonObjectFromResource(String name) throws IOException
    {
        JsonReader reader = null;
        try
        {
            URL url = NCubeManager.class.getResource("/" + name);
            File jsonFile = new File(url.getFile());
            InputStream in = new BufferedInputStream(new FileInputStream(jsonFile));
            reader = new JsonReader(in, true);
            return (JsonObject) reader.readObject();
        }
        finally
        {
            IOUtilities.close(reader);
        }
View Full Code Here

                ba_out.writeTo(out);
                IOUtilities.close(out);
                getCookies(c);

                // Get the return value of the call
                JsonReader reader;

                if (LOG.isDebugEnabled())
                {
                    ByteArrayOutputStream input = new ByteArrayOutputStream(32768);
                    IOUtilities.transfer(IOUtilities.getInputStream(c), input);
                    byte[] bytes = input.toByteArray();
                    String jsonResp = new String(bytes, "UTF-8");
                    LOG.debug(jsonResp);
                    reader = new JsonReader(new ByteArrayInputStream(bytes));
                }
                else
                {
                    reader = new JsonReader(IOUtilities.getInputStream(c));
                }
                Object[] res = (Object[]) reader.readObject();

                // Do we need to close reader?  Don't want to stop http keep alives.
                reader.close();
                Object result = res[0];
                checkForThrowable(result);
                return result;
            }
            catch (ThreadDeath e)
View Full Code Here

    /**
     * Still used in getNCubesFromResource
     */
    private static JsonObject getJsonObjectFromResource(String name) throws IOException
    {
        JsonReader reader = null;
        try
        {
            URL url = NCubeManager.class.getResource("/" + name);
            File jsonFile = new File(url.getFile());
            InputStream in = new BufferedInputStream(new FileInputStream(jsonFile));
            reader = new JsonReader(in, true);
            return (JsonObject) reader.readObject();
        }
        finally
        {
            IOUtilities.close(reader);
        }
View Full Code Here

        try
        {
            URL url = NCubeManager.class.getResource("/" + name);
            File jsonFile = new File(url.getFile());
            FileInputStream in = new FileInputStream(jsonFile);
            JsonReader reader = new JsonReader(in, true);
            JsonObject jObj = (JsonObject) reader.readObject();
            reader.close();
            String json = JsonWriter.objectToJson(jObj);
            NCube ncube = NCube.fromSimpleJson(json);
            addCube(ncube);
            return ncube;
        }
View Full Code Here

        try
        {
            URL url = NCubeManager.class.getResource("/" + name);
            File arrayJsonCubes = new File(url.getFile());
            FileInputStream in = new FileInputStream(arrayJsonCubes);
            JsonReader reader = new JsonReader(in, true);
            JsonObject ncubes = (JsonObject) reader.readObject();
            Object[] cubes = ncubes.getArray();
            List<NCube> cubeList = new ArrayList<NCube>(cubes.length);

            for (Object cube : cubes)
            {
View Full Code Here

                ba_out.writeTo(out);
                IOUtilities.close(out);
                getCookies(c);

                // Get the return value of the call
                JsonReader reader;

                if (LOG.isDebugEnabled())
                {
                    ByteArrayOutputStream input = new ByteArrayOutputStream(32768);
                    IOUtilities.transfer(IOUtilities.getInputStream(c), input);
                    byte[] bytes = input.toByteArray();
                    String jsonResp = new String(bytes, "UTF-8");
                    LOG.debug(jsonResp);
                    reader = new JsonReader(new ByteArrayInputStream(bytes));
                }
                else
                {
                    reader = new JsonReader(IOUtilities.getInputStream(c));
                }
                Object[] res = (Object[]) reader.readObject();

                // Do we need to close reader?  Don't want to stop http keep alives.
                reader.close();
                Object result = res[0];
                checkForThrowable(result);
                return result;
            }
            catch (ThreadDeath e)
View Full Code Here

                ba_out.writeTo(out);
                IOUtilities.close(out);
                getCookies(c);

                // Get the return value of the call
                JsonReader reader;

                if (LOG.isDebugEnabled())
                {
                    ByteArrayOutputStream input = new ByteArrayOutputStream(32768);
                    IOUtilities.transfer(IOUtilities.getInputStream(c), input);
                    byte[] bytes = input.toByteArray();
                    String jsonResp = new String(bytes, "UTF-8");
                    LOG.debug(jsonResp);
                    reader = new JsonReader(new ByteArrayInputStream(bytes));
                }
                else
                {
                    reader = new JsonReader(IOUtilities.getInputStream(c));
                }
                Object[] res = (Object[]) reader.readObject();

                // Do we need to close reader?  Don't want to stop http keep alives.
                reader.close();
                Object result = res[0];
                checkForThrowable(result);
                return result;
            }
            catch (ThreadDeath e)
View Full Code Here

    /**
     * Still used in getNCubesFromResource
     */
    private static JsonObject getJsonObjectFromResource(String name) throws IOException
    {
        JsonReader reader = null;
        try
        {
            URL url = NCubeManager.class.getResource("/" + name);
            File jsonFile = new File(url.getFile());
            InputStream in = new BufferedInputStream(new FileInputStream(jsonFile));
            reader = new JsonReader(in, true);
            return (JsonObject) reader.readObject();
        }
        finally
        {
            IOUtilities.close(reader);
        }
View Full Code Here

        try
        {
            URL url = NCubeManager.class.getResource("/" + name);
            File jsonFile = new File(url.getFile());
            FileInputStream in = new FileInputStream(jsonFile);
            JsonReader reader = new JsonReader(in, true);
            JsonObject jObj = (JsonObject) reader.readObject();
            reader.close();
            String json = JsonWriter.objectToJson(jObj);
            NCube ncube = NCube.fromSimpleJson(json);
            addCube(ncube, "file");
            return ncube;
        }
View Full Code Here

TOP

Related Classes of com.cedarsoftware.util.io.JsonReader$CollectionFactory

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.