Example usage for org.apache.hadoop.io.serializer Serializer Serializer

List of usage examples for org.apache.hadoop.io.serializer Serializer Serializer

Introduction

In this page you can find the example usage for org.apache.hadoop.io.serializer Serializer Serializer.

Prototype

Serializer

Source Link

Usage

From source file:org.apache.gora.mapreduce.StringSerialization.java

License:Apache License

@Override
public Serializer<String> getSerializer(Class<String> c) {
    return new Serializer<String>() {

        private DataOutputStream out;

        @Override/*  ww w.j a  v a2 s . c  om*/
        public void close() throws IOException {
            this.out.close();
        }

        @Override
        public void open(OutputStream out) throws IOException {
            this.out = new DataOutputStream(out);
        }

        @Override
        public void serialize(String str) throws IOException {
            Text.writeString(out, str);
        }
    };
}