Package com.esotericsoftware.kryo

Examples of com.esotericsoftware.kryo.SerializationException


        encrypt.init(Cipher.ENCRYPT_MODE, keySpec);
        context.put(this, "encryptCipher", encrypt);
      }
      encrypt.doFinal(inputBuffer, outputBuffer);
    } catch (GeneralSecurityException ex) {
      throw new SerializationException(ex);
    }
  }
View Full Code Here


        decrypt.init(Cipher.DECRYPT_MODE, keySpec);
        context.put(this, "decryptCipher", decrypt);
      }
      decrypt.doFinal(inputBuffer, outputBuffer);
    } catch (GeneralSecurityException ex) {
      throw new SerializationException(ex);
    }
  }
View Full Code Here

      IntSerializer.put(buffer, array.length, true);
      buffer.put(array);
    } catch (BufferOverflowException ex) {
      throw ex;
    } catch (Exception ex) {
      throw new SerializationException("Error during Java serialization.", ex);
    }
  }
View Full Code Here

    byte[] array = new byte[length];
    buffer.get(array);
    try {
      return (T)new ObjectInputStream(new ByteArrayInputStream(array)).readObject();
    } catch (Exception ex) {
      throw new SerializationException("Error during Java deserialization.", ex);
    }
  }
View Full Code Here

        while (length-- > 0)
          outputBuffer.put(deltaData.get());
        break;
      case COMMAND_COPY:
        // Copy old data.
        if (oldData == null) throw new SerializationException("Delta copy command received without previous data.");
        int offset = IntSerializer.get(deltaData, true);
        if (debug)
          System.out.println("decompress COPY at " + offset + ", length " + length + ": " + dump(oldData, offset, length));
        oldData.position(offset);
        while (length-- > 0)
          outputBuffer.put(oldData.get());
        break;
      default:
        throw new SerializationException("Invalid delta command: " + command);
      }
    }
  }
View Full Code Here

    inflater.reset();
    inflater.setInput(inputBytes, 0, inputLength);
    try {
      outputBuffer.position(inflater.inflate(outputBuffer.array()));
    } catch (DataFormatException ex) {
      throw new SerializationException("Error inflating data.", ex);
    }
  }
View Full Code Here

          buffer.position(start);
          IntSerializer.put(buffer, dataLength, true);
          buffer.put(temp);
        }
      } catch (IllegalAccessException ex) {
        throw new SerializationException("Error accessing field in class: " + object.getClass().getName(), ex);
      } catch (SerializationException ex) {
        ex.addTrace(cachedField + " (" + object.getClass().getName() + ")");
        throw ex;
      } catch (RuntimeException runtimeEx) {
        SerializationException ex = new SerializationException(runtimeEx);
        ex.addTrace(cachedField + " (" + object.getClass().getName() + ")");
        throw ex;
      }
    }
    if (TRACE) trace("kryo", "Wrote object: " + object);
  }
View Full Code Here

          }
        }

        cachedField.set(object, value);
      } catch (IllegalAccessException ex) {
        throw new SerializationException("Error accessing field in class: " + type.getName(), ex);
      } catch (SerializationException ex) {
        ex.addTrace(cachedField + " (" + type.getName() + ")");
        throw ex;
      } catch (RuntimeException runtimeEx) {
        SerializationException ex = new SerializationException(runtimeEx);
        ex.addTrace(cachedField + " (" + type.getName() + ")");
        throw ex;
      }
    }
    if (TRACE) trace("kryo", "Read object: " + object);
    return object;
View Full Code Here

  }

  public <T> T readObjectData (ByteBuffer buffer, Class<T> type) {
    int ordinal = IntSerializer.get(buffer, true);
    if (ordinal < 0 || ordinal > enumConstants.length - 1)
      throw new SerializationException("Invalid ordinal for enum \"" + type.getName() + "\": " + ordinal);
    Object constant = enumConstants[ordinal];
    if (TRACE) trace("kryo", "Read enum: " + constant);
    return (T)constant;
  }
View Full Code Here

    IntSerializer.put(buffer, object.ordinal(), true);
  }

  static public <T> T get (ByteBuffer buffer, Class<T> type) {
    T[] enumConstants = type.getEnumConstants();
    if (enumConstants == null) throw new SerializationException("Class is not an enum: " + type.getName());
    int ordinal = IntSerializer.get(buffer, true);
    if (ordinal < 0 || ordinal > enumConstants.length - 1)
      throw new SerializationException("Invalid ordinal for enum \"" + type.getName() + "\": " + ordinal);
    return enumConstants[ordinal];
  }
View Full Code Here

TOP

Related Classes of com.esotericsoftware.kryo.SerializationException

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.