Package org.eclipse.jetty.nosql.kvs.session

Examples of org.eclipse.jetty.nosql.kvs.session.TranscoderException


      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


    try {
      ByteArrayInputStream stream = new ByteArrayInputStream(raw);
      Input input = new Input(stream);
      obj = kryo.readObject(input, klass);
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return obj;
  }
View Full Code Here

  public byte[] pack(ISerializableSession session, ISerializationTranscoder tc) throws TranscoderException {
    byte[] raw = null;
    try {
      raw = tc.encode(session);
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return raw;
  }
View Full Code Here

  public ISerializableSession unpack(byte[] raw, ISerializationTranscoder tc) throws TranscoderException {
    ISerializableSession session = null;
    try {
      session = tc.decode(raw, KryoSession.class);
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return session;
  }
View Full Code Here

  public byte[] encode(Object obj) throws TranscoderException {
    byte[] raw = null;
    try {
      raw = xstream.toXML(obj).getBytes("UTF-8");
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return raw;
  }
View Full Code Here

  public <T> T decode(byte[] raw, Class<T> klass) throws TranscoderException {
    T obj = null;
    try {
      obj = (T) xstream.fromXML(new String(raw, "UTF-8"));
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return obj;
  }
View Full Code Here

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(obj);
      raw = baos.toByteArray();
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return raw;
  }
View Full Code Here

    try {
      ByteArrayInputStream bais = new ByteArrayInputStream(raw);
      ObjectInputStream ois = new ClassLoadingObjectInputStream(bais, classLoader);
      obj = ois.readObject();
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return (T) obj;
  }
View Full Code Here

  public byte[] pack(ISerializableSession session, ISerializationTranscoder tc) throws TranscoderException {
    byte[] raw = null;
    try {
      raw = tc.encode(session);
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return raw;
  }
View Full Code Here

  public ISerializableSession unpack(byte[] raw, ISerializationTranscoder tc) throws TranscoderException {
    ISerializableSession session = null;
    try {
      session = tc.decode(raw, XStreamSession.class);
    } catch (Exception error) {
      throw(new TranscoderException(error));
    }
    return session;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.nosql.kvs.session.TranscoderException

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.