From ebaa87cdfbb685aea9407cd58801495f03800deb Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Sat, 9 Jun 2018 08:59:02 +0200 Subject: [PATCH] Code formatting. --- .../serializers/ExternalizableSerializer.java | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/com/esotericsoftware/kryo/serializers/ExternalizableSerializer.java b/src/com/esotericsoftware/kryo/serializers/ExternalizableSerializer.java index 0b58a30e6..bb168f697 100644 --- a/src/com/esotericsoftware/kryo/serializers/ExternalizableSerializer.java +++ b/src/com/esotericsoftware/kryo/serializers/ExternalizableSerializer.java @@ -49,11 +49,10 @@ public class ExternalizableSerializer extends Serializer { public void write (Kryo kryo, Output output, Object object) { JavaSerializer serializer = getJavaSerializerIfRequired(object.getClass()); - if (serializer == null) { + if (serializer == null) writeExternal(kryo, output, object); - } else { + else serializer.write(kryo, output, object); - } } public Object read (Kryo kryo, Input input, Class type) { @@ -81,36 +80,28 @@ private Object readExternal (Kryo kryo, Input input, Class type) { } private ObjectOutput getObjectOutput (Kryo kryo, Output output) { - if (objectOutput == null) { + if (objectOutput == null) objectOutput = new KryoObjectOutput(kryo, output); - } else { + else objectOutput.setOutput(output); - } - return objectOutput; } private ObjectInput getObjectInput (Kryo kryo, Input input) { - if (objectInput == null) { + if (objectInput == null) objectInput = new KryoObjectInput(kryo, input); - } else { + else objectInput.setInput(input); - } - return objectInput; } /** Determines if this class requires the fall-back {@code JavaSerializer}. If the class does not require any specialized Java * serialization features then null will be returned. - * * @param type the type we wish to externalize * @return a {@code JavaSerializer} if the type requires more than simple externalization. */ private JavaSerializer getJavaSerializerIfRequired (Class type) { JavaSerializer javaSerializer = getCachedSerializer(type); - if (javaSerializer == null && isJavaSerializerRequired(type)) { - javaSerializer = new JavaSerializer(); - } - + if (javaSerializer == null && isJavaSerializerRequired(type)) javaSerializer = new JavaSerializer(); return javaSerializer; } @@ -123,7 +114,7 @@ private JavaSerializer getCachedSerializer (Class type) { } private boolean isJavaSerializerRequired (Class type) { - return (hasInheritableReplaceMethod(type, "writeReplace") || hasInheritableReplaceMethod(type, "readResolve")); + return hasInheritableReplaceMethod(type, "writeReplace") || hasInheritableReplaceMethod(type, "readResolve"); } /* find out if there are any pesky serialization extras on this class */