0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 package org.apache.spark.serializer;
0019
0020 import java.io.IOException;
0021 import java.io.InputStream;
0022 import java.io.OutputStream;
0023 import java.nio.ByteBuffer;
0024
0025 import scala.reflect.ClassTag;
0026
0027 import org.apache.spark.annotation.Private;
0028 import org.apache.spark.unsafe.Platform;
0029
0030
0031
0032
0033
0034
0035
0036 @Private
0037 public final class DummySerializerInstance extends SerializerInstance {
0038
0039 public static final DummySerializerInstance INSTANCE = new DummySerializerInstance();
0040
0041 private DummySerializerInstance() { }
0042
0043 @Override
0044 public SerializationStream serializeStream(final OutputStream s) {
0045 return new SerializationStream() {
0046 @Override
0047 public void flush() {
0048
0049 try {
0050 s.flush();
0051 } catch (IOException e) {
0052 Platform.throwException(e);
0053 }
0054 }
0055
0056 @Override
0057 public <T> SerializationStream writeObject(T t, ClassTag<T> ev1) {
0058 throw new UnsupportedOperationException();
0059 }
0060
0061 @Override
0062 public void close() {
0063
0064 try {
0065 s.close();
0066 } catch (IOException e) {
0067 Platform.throwException(e);
0068 }
0069 }
0070 };
0071 }
0072
0073 @Override
0074 public <T> ByteBuffer serialize(T t, ClassTag<T> ev1) {
0075 throw new UnsupportedOperationException();
0076 }
0077
0078 @Override
0079 public DeserializationStream deserializeStream(InputStream s) {
0080 throw new UnsupportedOperationException();
0081 }
0082
0083 @Override
0084 public <T> T deserialize(ByteBuffer bytes, ClassLoader loader, ClassTag<T> ev1) {
0085 throw new UnsupportedOperationException();
0086 }
0087
0088 @Override
0089 public <T> T deserialize(ByteBuffer bytes, ClassTag<T> ev1) {
0090 throw new UnsupportedOperationException();
0091 }
0092 }