Examples of Serializer


Examples of com.granule.json.internal.Serializer

     * @param indentDepth How many spaces to use for each indent level.  Should be one to eight. 
     *
     * @throws JSONException Thrown on IO errors during serialization.
     */
    public Writer write(Writer writer, int indentDepth) throws JSONException {
        Serializer serializer;

        if (indentDepth < 1) {
            indentDepth = 0;
        } else if (indentDepth > 8) {
            indentDepth = 9;
        }

        //Try to avoid double-buffering or buffering in-memory
        //writers.
        Class writerClass = writer.getClass();
        if (!StringWriter.class.isAssignableFrom(writerClass) &&
            !CharArrayWriter.class.isAssignableFrom(writerClass) &&
            !BufferedWriter.class.isAssignableFrom(writerClass)) {
            writer = new BufferedWriter(writer);
        }

        if (indentDepth > 0) {
            serializer = new SerializerVerbose(writer, indentDepth);
        } else {
            serializer = new Serializer(writer);
        }
        try {
            serializer.writeArray(this);
        } catch (IOException iox) {
            JSONException jex = new JSONException("Error occurred during input read.");
            jex.initCause(iox);
            throw jex;
        }
View Full Code Here

Examples of com.granule.json.internal.Serializer

     * @param verbose Whether or not to write in compressed for formatted Strings.
     *
     * @throws JSONException Thrown on IO errors during serialization.
     */
    public String write(boolean verbose) throws JSONException {
        Serializer serializer;
        StringWriter writer = new StringWriter();

        if (verbose) {
            serializer = new SerializerVerbose(writer);
        } else {
            serializer = new Serializer(writer);
        }
        try {
            serializer.writeArray(this).flush();
        } catch (IOException iox) {
            JSONException jex = new JSONException("Error occurred during input read.");
            jex.initCause(iox);
            throw jex;
        }
View Full Code Here

Examples of com.granule.json.internal.Serializer

     * @param indentDepth How many spaces to use for each indent level.  Should be one to eight. 
     *
     * @throws JSONException Thrown on IO errors during serialization.
     */
    public String write(int indentDepth) throws JSONException {
        Serializer serializer;
        StringWriter writer = new StringWriter();

        if (indentDepth < 1) {
            indentDepth = 0;
        } else if (indentDepth > 8) {
            indentDepth = 9;
        }

        if (indentDepth > 0) {
            serializer = new SerializerVerbose(writer, indentDepth);
        } else {
            serializer = new Serializer(writer);
        }
        try {
            serializer.writeArray(this).flush();
        } catch (IOException iox) {
            JSONException jex = new JSONException("Error occurred during input read.");
            jex.initCause(iox);
            throw jex;
        }
View Full Code Here

Examples of com.lightcrafts.mediax.jai.remote.Serializer

    private void writeObject(ObjectOutputStream out) throws IOException {

        int numSerializers = theSerializers.length;
        out.writeInt(numSerializers);
        for(int i = 0; i < numSerializers; i++) {
            Serializer s = theSerializers[i];
            out.writeObject(s.getSupportedClass());
            out.writeObject(s.getState(theObject, hints));
        }
    }
View Full Code Here

Examples of com.lightcrafts.mediax.jai.remote.Serializer

                                   SerializerImpl.class, false);
        }

        int numClasses = classes.length;
        for(int i = 0; i < numClasses; i++) {
            Serializer s = new SerializerImpl(ssi, classes[i],
                                              supportsSubclasses);
            SerializerFactory.registerSerializer(s);
        }
    }
View Full Code Here

Examples of com.netflix.astyanax.Serializer

        return result;
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    private static <T> Serializer<T> serializerFor(Class<?> valueClass) {
        Serializer serializer = null;
        if (valueClass.equals(UUID.class)) {
            serializer = UUIDSerializer.get();
        } else if (valueClass.equals(String.class)) {
            serializer = StringSerializer.get();
        } else if (valueClass.equals(Long.class) || valueClass.equals(long.class)) {
View Full Code Here

Examples of com.netflix.zeno.hash.HashGenericRecordSerializers.Serializer

            }
            if (obj.getClass().isEnum()) {
                hasher.write(((Enum<?>) obj).name());
            } else if (obj.getClass().isArray()) {
                if (obj.getClass().getComponentType().isPrimitive()) {
                    Serializer serializer = HashGenericRecordSerializers.getPrimitiveArraySerializer(obj.getClass().getComponentType());
                    if (serializer == null) {
                        throw new RuntimeException("Can't find serializer for array of type:" + obj.getClass());
                    }
                    serializer.serialize(hasher, obj);
                } else {
                    Object[] objects = (Object[]) obj;
                    for (Object object : objects) {
                        write(object);
                    }
                }
            } else {
                Serializer serializer = HashGenericRecordSerializers.getTypeSerializer(obj.getClass());
                if (serializer == null) {
                    throw new RuntimeException("Can't find serializer for type:" + obj.getClass());
                }
                serializer.serialize(hasher, obj);
            }
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }
View Full Code Here

Examples of com.projity.server.data.Serializer

  }

  protected ProjectData projectData;

    public Job getImportFileJob(){
      final Serializer serializer=new Serializer();
      final FileImporter importer=this;
      final Job job=new Job(importer.getJobQueue(),"importFile",Messages.getString("LocalFileImporter.Importing"),true); //$NON-NLS-1$ //$NON-NLS-2$
        job.addRunnable(new JobRunnable("Import",1.0f){ //$NON-NLS-1$
        public Object run() throws Exception{
              //DataUtil serializer=new DataUtil();
              System.out.println("Loading "+importer.getFileName()+"..."); //$NON-NLS-1$ //$NON-NLS-2$

              long t1=System.currentTimeMillis();
              ObjectInputStream in=new ObjectInputStream(new FileInputStream(importer.getFileName()));
              Object obj=in.readObject();
              if (obj instanceof String) obj=in.readObject(); //check version in the future
              projectData=(ProjectData)obj;
              projectData.setMaster(false);
              projectData.setLocal(false);
              long t2=System.currentTimeMillis();
              System.out.println("Loading...Done in "+(t2-t1)+" ms"); //$NON-NLS-1$ //$NON-NLS-2$

              Collection<ResourceData> rs=(Collection<ResourceData>)projectData.getResources();
              List<EnterpriseResourceData> ers=new ArrayList<EnterpriseResourceData>(rs.size());
              for (ResourceData r: rs){
                ers.add(r.getEnterpriseResource());
              }

        ((ServerFileImporter)importer).prepareResources(ers,null,false);
        renumberProject();

              setProgress(1.0f);
                return null;
        }
        });

      job.addSwingRunnable(new JobRunnable("Import resources",1.0f){ //$NON-NLS-1$
      public Object run() throws Exception{
        ResourceMappingForm form=getResourceMapping();
        if (form!=null&&form.isLocal()) //if form==null we are in a case were have no server access. popup not needed
          if (!job.okCancel(Messages.getString("Message.ServerUnreacheableReadOnlyProject"),true)){ //$NON-NLS-1$
            setProgress(1.0f);
            throw new Exception(ABORT);
          }

        if(!importResources()){
          setProgress(1.0f);
          throw new JobCanceledException(ABORT);
        }
        setProgress(1f);
        return null;
        }
      });

        job.addRunnable(new JobRunnable("Import",1.0f){ //$NON-NLS-1$
        public Object run() throws Exception{
              System.out.println("Deserializing..."); //$NON-NLS-1$
              long t1=System.currentTimeMillis();
              ResourceMappingForm form=getResourceMapping();
//              project=serializer.deserializeProject(projectData,false,true,resourceMap);
              //DEF165936:  Projity: .pod file import fails mapped to resource with modified calendar
              //pass the map into the serializer so it can grab the original impls
//              serializer.SetStuffForPODDeserialization(form.getExistingProject(), _localResourceMap); //claur
              Project project=serializer.deserializeProject(projectData,false,null,null,null,false);
              if (project!=null&&!Environment.getStandAlone()) project.setAllDirty();
              importer.setProject(project);
              long t2=System.currentTimeMillis();
              System.out.println("Deserializing...Done in "+(t2-t1)+" ms"); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

Examples of com.sun.org.apache.xml.internal.serialize.Serializer

        out = new StringWriter();
        ve = new VariableExpander(new Framer(frameHolder));
        ve.setParent(getXMLReader());
        OutputFormat of = new OutputFormat();
        of.setOmitXMLDeclaration(true);       
        Serializer ts = new XMLSerializer(of);
        ts.setOutputCharStream(out);
        ve.setContentHandler(ts.asContentHandler());
    }
View Full Code Here

Examples of com.tangosol.io.Serializer

    cache.invokeAll(AlwaysFilter.INSTANCE, new CommitEntryProcessor(decorationNo));
    dirty = false;
  }
 
  private void push(Map<Object, Object> batch) {
    Serializer serializer = cache.getCacheService().getSerializer();
    Map<Binary, Binary> binMap = new HashMap<Binary, Binary>(batch.size());
    for(Map.Entry<Object, Object> entry: batch.entrySet()) {
      Binary key = ExternalizableHelper.toBinary(entry.getKey(), serializer);
      Binary value = ExternalizableHelper.toBinary(entry.getValue(), serializer);
      binMap.put(key, value);
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.