1 module dcrypt.encoders.encoder; 2 3 /// This is usually thrown while decoding invalid data. 4 @safe 5 public class InvalidEncodingException : Exception { 6 pure this(string msg) { 7 super(msg); 8 } 9 } 10 11 @safe 12 public class Encoder { 13 14 /** 15 * Params: 16 * input = data to encode 17 * 18 * Returns: 19 * encoded data 20 */ 21 @safe 22 public pure abstract ubyte[] encode(in ubyte[] input); 23 24 /** 25 * Params: 26 * input = data to decode 27 * 28 * Returns: 29 * decoded data 30 * 31 * Throws: InvalidEncodingException 32 */ 33 @safe 34 public pure abstract ubyte[] decode(in ubyte[] input); 35 36 37 }