Kinetica   C#   API  Version 7.2.3.0
Codec.cs
Go to the documentation of this file.
1 
18 using System;
19 using System.Collections.Generic;
20 using System.Linq;
21 using System.Text;
22 using System.IO;
23 
24 namespace Avro.File
25 {
26  abstract public class Codec
27  {
33  abstract public byte[] Compress(byte[] uncompressedData);
34 
40  abstract public byte[] Decompress(byte[] compressedData);
41 
46  abstract public string GetName();
47 
53  abstract public override bool Equals(object other);
54 
60  abstract public override int GetHashCode();
61 
65  public enum Type
66  {
67  Deflate,
68  //Snappy
69  Null
70  };
71 
78  public static Codec CreateCodec(Type codecType)
79  {
80  switch (codecType)
81  {
82  case Type.Deflate:
83  return new DeflateCodec();
84  default:
85  return new NullCodec();
86  }
87  }
88 
95  public static Codec CreateCodecFromString(string codecType)
96  {
97  switch (codecType)
98  {
100  return new DeflateCodec();
101  default:
102  return new NullCodec();
103  }
104  }
105 
110  public override string ToString()
111  {
112  return GetName();
113  }
114  }
115 }
abstract override bool Equals(object other)
Codecs must implement an equals() method
abstract string GetName()
Name of this codec type
static Codec CreateCodecFromString(string codecType)
Factory method to return child codec instance based on string type
Definition: Codec.cs:95
abstract byte [] Decompress(byte[] compressedData)
Decompress data using implemented codec
Type
Codec types
Definition: Codec.cs:65
override string ToString()
Returns name of codec
Definition: Codec.cs:110
abstract byte [] Compress(byte[] uncompressedData)
Compress data using implemented codec
abstract override int GetHashCode()
Codecs must implement a HashCode() method that is consistent with Equals
static Codec CreateCodec(Type codecType)
Factory method to return child codec instance based on Codec.Type
Definition: Codec.cs:78