Package com.esotericsoftware.kryo.io

Examples of com.esotericsoftware.kryo.io.Output


    buffer.append(expression);
    return buffer.toString();
  }

  public String toKryo() {
    Output out = new Output(4 * 1024, 10 * 1024 * 1024);
    new Kryo().writeObject(out, this);
    out.close();
    return Base64.encodeBase64String(out.toBytes());
  }
View Full Code Here


   * @param expr Expression.
   * @return Bytes.
   */
  public static byte[] serializeExpressionToKryo(ExprNodeGenericFuncDesc expr) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Output output = new Output(baos);
    runtimeSerializationKryo.get().writeObject(output, expr);
    output.close();
    return baos.toByteArray();
  }
View Full Code Here

  /**
   * @param plan Usually of type MapredWork, MapredLocalWork etc.
   * @param out stream in which serialized plan is written into
   */
  private static void serializeObjectByKryo(Kryo kryo, Object plan, OutputStream out) {
    Output output = new Output(out);
    kryo.writeObject(output, plan);
    output.close();
  }
View Full Code Here

  public boolean closeConnection() {
    Path statsDir = new Path(conf.get(StatsSetupConst.STATS_TMP_LOC));
    try {
      Path statsFile = new Path(statsDir,StatsSetupConst.STATS_FILE_PREFIX +conf.getInt("mapred.task.partition",0));
      LOG.debug("About to create stats file for this task : " + statsFile);
      Output output = new Output(statsFile.getFileSystem(conf).create(statsFile,true));
      LOG.info("Created file : " + statsFile);
      LOG.info("Writing stats in it : " + statsMap);
      Utilities.runtimeSerializationKryo.get().writeObject(output, statsMap);
      output.close();
      return true;
    } catch (IOException e) {
      LOG.error(e);
      return false;
    }
View Full Code Here

  public byte[] encode(Object obj) throws TranscoderException {
    byte[] raw = null;
    try {
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      Output output = new Output(stream);
      kryo.writeObject(output, obj);
      output.close();
      raw = stream.toByteArray();
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return raw;
View Full Code Here

    return deserializeExpressionFromKryo(bytes);
  }

  private static byte[] serializeObjectToKryo(Serializable object) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Output output = new Output(baos);
    runtimeSerializationKryo.get().writeObject(output, object);
    output.close();
    return baos.toByteArray();
  }
View Full Code Here

  /**
   * @param plan Usually of type MapredWork, MapredLocalWork etc.
   * @param out stream in which serialized plan is written into
   */
  private static void serializeObjectByKryo(Kryo kryo, Object plan, OutputStream out) {
    Output output = new Output(out);
    kryo.writeObject(output, plan);
    output.close();
  }
View Full Code Here

    buffer.append(expression);
    return buffer.toString();
  }

  public String toKryo() {
    Output out = new Output(4 * 1024, 10 * 1024 * 1024);
    new Kryo().writeObject(out, this);
    out.close();
    return Base64.encodeBase64String(out.toBytes());
  }
View Full Code Here

            kryo.register(r.getType(), r.getSerializer(), r.getId());
    }

    @Override
    public byte[] write(Object object) {
        final Output output = new KryoObjectOutputStream(512, -1);
        kryo.writeClassAndObject(output, object);
        output.flush();
        return output.toBytes();
    }
View Full Code Here

        return kryo.readObjectOrNull(input, type);
    }

    @Override
    public void write(OutputStream os, Object object) {
        final Output output = toKryoObjectOutputStream(os);
        kryo.writeClassAndObject(output, object);
        output.flush();
    }
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryo.io.Output

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.