Examples of Serializer


Examples of org.jvyamlb.Serializer

            io2 = self.getRuntime().fastGetClass("StringIO").callMethod(context, "new");
            iox = new IOOutputStream(io2);
        } else {
            iox = new IOOutputStream(io);
        }
        Serializer ser = new JRubySerializer(new EmitterImpl(iox,cfg),new ResolverImpl(),cfg);
        try {
            ser.open();
            Representer r = new JRubyRepresenter(ser, cfg);
            for(Iterator iter = objs.getList().iterator();iter.hasNext();) {
                r.represent(iter.next());
            }
            ser.close();
        } catch(IOException e) {
            throw self.getRuntime().newIOErrorFromException(e);
        }
        if(null == io) {
            io2.callMethod(context, "rewind");
View Full Code Here

Examples of org.mapdb.Serializer

         * not to compress BTree Nodes and Keys.
         */
        DB db2 = DBMaker.newMemoryDB().make(); //no store wide compression this time

        //construct value serializier, use default serializier
        Serializer valueSerializer = db2.getDefaultSerializer();
        //but wrap it, to compress its output
        valueSerializer = new Serializer.CompressionWrapper(valueSerializer);

        //now construct map, with additional options
        Map map2 = db2.createTreeMap("test")
View Full Code Here

Examples of org.milyn.delivery.dom.serialize.Serializer

     *                         DOM Serialiser exception.
     * @throws IOException     Unable to write to output writer.
     * @throws SmooksException Unable to serialise due to bad Smooks environment.  Check cause.
     */
    public void serialize(Node node, Writer writer) throws IOException, SmooksException {
        Serializer serializer;

        if (node == null) {
            throw new IllegalArgumentException("null 'doc' arg passed in method call.");
        } else if (writer == null) {
            throw new IllegalArgumentException("null 'writer' arg passed in method call.");
        }

        if (logger.isDebugEnabled()) {
            logger.debug("Starting serialization phase [" + executionContext.getTargetProfiles().getBaseProfile() + "]");
        }
        serializer = new Serializer(node, executionContext);
        try {
            serializer.serailize(writer);
        } catch (ResourceConfigurationNotFoundException e) {
            throw new SmooksException("Unable to serialize document.", e);
        }
    }
View Full Code Here

Examples of org.neo4j.com.Serializer

        return type != HaRequestType.COPY_STORE;
    }
   
    public Response<IdAllocation> allocateIds( final IdType idType )
    {
        return sendRequest( HaRequestType.ALLOCATE_IDS, SlaveContext.EMPTY, new Serializer()
        {
            public void write( ChannelBuffer buffer, ByteBuffer readBuffer ) throws IOException
            {
                buffer.writeByte( idType.ordinal() );
            }
View Full Code Here

Examples of org.neo4j.smack.serialization.Serializer

            // way down to it's deepest dungeons, and then eventually copies it into
            // kernel space. We need to know when that has happened and reuse the buffer.
            // Perhaps introduce a ring buffer to rotate used buffers back up here?
            final DynamicChannelBuffer content = new DynamicChannelBuffer(
                    1000);
            Serializer serializer = serializationFactory.getSerializer(content);
            serializationStrategy.serialize(data, serializer);
            serializer.flush();
           
            response.setHeader(HttpHeaders.Names.CONTENT_TYPE, serializer.getContentType().toString());
            response.setHeader(HttpHeaders.Names.CONTENT_LENGTH, content.writerIndex());
            response.setContent(content);
        }

        ChannelFuture future = channel.write(response);
View Full Code Here

Examples of org.prevayler.foundation.serialization.Serializer

  private P readSnapshot(File snapshotFile) throws Exception {
    String suffix = snapshotFile.getName().substring(snapshotFile.getName().indexOf('.') + 1);
    if (!_strategies.containsKey(suffix)) throw new IOException(
        snapshotFile.toString() + " cannot be read; only " + _strategies.keySet().toString() + " supported");

    Serializer serializer = (Serializer) _strategies.get(suffix);
    FileInputStream in = new FileInputStream(snapshotFile);
    try {
      return (P) (serializer.readObject(in));
    } finally {
      in.close();
    }
  }
View Full Code Here

Examples of org.red5.io.object.Serializer

    }
    if (audioCodecId != null) {
      params.put("audiocodecid", audioCodecId.intValue());
    }
    params.put("canSeekToEnd", true);
    out.writeMap(params, new Serializer());
    buf.flip();

    if (fileMetaSize == 0) {
      fileMetaSize = buf.limit();
    }
View Full Code Here

Examples of org.reflections.serializers.Serializer

     * it is preferred to use a designated resource prefix (for example META-INF/reflections but not just META-INF),
     * so that relevant urls could be found much faster
     * @param optionalSerializer - optionally supply one serializer instance. if not specified or null, {@link XmlSerializer} will be used
     */
    public static Reflections collect(final String packagePrefix, final Predicate<String> resourceNameFilter, @Nullable Serializer... optionalSerializer) {
        Serializer serializer = optionalSerializer != null && optionalSerializer.length == 1 ? optionalSerializer[0] : new XmlSerializer();
        final Reflections reflections = new Reflections();

        for (final Vfs.File file : Vfs.findFiles(ClasspathHelper.forPackage(packagePrefix), packagePrefix, resourceNameFilter)) {
            InputStream inputStream = null;
            try {
                inputStream = file.openInputStream();
                reflections.merge(serializer.read(inputStream));
                if (log != null) log.info("Reflections collected metadata from " + file + " using serializer " + serializer.getClass().getName());
            } catch (IOException e) {
                throw new ReflectionsException("could not merge " + file, e);
            } finally {
                close(inputStream);
            }
View Full Code Here

Examples of org.simpleframework.xml.Serializer

        final File path = given.getParentFile();

        // First, check if there already is a merged file. In that case, load it.
        if (new File(file + ".merged").exists()) {
            try {
                final Serializer serializer = new Persister(new XMLTransformationMatcher());
                return serializer.read(SessionRecordImpl.class, new File(file + ".merged"));
            } catch (final Exception e) {
                e.printStackTrace();
            }
        }

        // Check how many files we have
        final File[] listFiles = path.listFiles(new FilenameFilter() {

            @Override
            public boolean accept(final File dir, final String name) {
                if (name.endsWith("session.xml")) return false;
                if (name.endsWith(".xml")) return true;
                return false;
            }
        });

        String suffix = "";

        // TODO: Check last .xml if it's corrupt or not.

        // If we have more files, merge them
        if (listFiles.length > 1 && tryMerge) {
            /*
            final String[] files = new String[listFiles.length];

            for (int i = 0; i < files.length; i++) {
                files[i] = SessionMerger.readFileAsString(listFiles[i].getAbsolutePath());
            }

            final String merge = SessionMerger.merge(files);

            suffix = ".merged";

            try {
                final BufferedWriter out = new BufferedWriter(new FileWriter(file + suffix));
                out.write(merge);
                out.close();
            } catch (final IOException e1) {
                e1.printStackTrace();
            }*/
        }

        final File inFile = new File(file + suffix);
        File tmp = null;
        try {
            tmp = File.createTempFile("prefix", "suffix");
        } catch (IOException e1) {
            e1.printStackTrace();
        }

        final List<String> readLines = IO.readLines(inFile);
        final List<String> writeLines = new ArrayList<String>();
        for (String string : readLines) {
            String replaced = string;

            replaced = replaced.replaceAll("de.dfki.km.augmentedtext.browserplugin.services.sessionrecorder.events", "de.dfki.km.text20.browserplugin.services.sessionrecorder.events");
            replaced = replaced.replaceAll("de.dfki.km.augmentedtext.util.recorder.events", "de.dfki.km.text20.browserplugin.services.sessionrecorder.events");

            //System.out.println(replaced);
            writeLines.add(replaced);

        }
        IO.writeLines(tmp, writeLines);

        final SessionRecordImpl rval = null;
        try {
            final Serializer serializer = new Persister(new XMLTransformationMatcher());
            return serializer.read(SessionRecordImpl.class, tmp);
        } catch (final Exception e) {
            e.printStackTrace();
        }

        return rval;
View Full Code Here

Examples of org.switchyard.serial.Serializer

* @author David Ward &lt;<a href="mailto:dward@jboss.org">dward@jboss.org</a>&gt; &copy; 2012 Red Hat Inc.
*/
public final class RemoteMessageTest {

    private <T> T serDeser(T object, Class<T> clazz) throws Exception {
        Serializer ser = SerializerFactory.create(FormatType.JSON, null, true);
        byte[] bytes = ser.serialize(object, clazz);
        return ser.deserialize(bytes, clazz);
    }
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.