                                  count: 1 + LZMAConstants.numFullDistances - LZMAConstants.endPosModelIndex)
         self.lenDecoder = LZMALenDecoder()
         self.repLenDecoder = LZMALenDecoder()
+    }
+
+    func resetDictionary() {
+        self.dictStart = self.dictEnd
     }
 
     /// Main LZMA (algorithm) decoder function.

    /// An array for storing output data.
    var out = [UInt8]()

    // This array will also serve as dictionary and out window.
    private var dictStart = 0
    private var dictEnd = 0



    // MARK: Dictionary (out window) related functions.

    func put(_ byte: UInt8) {
        out.append(byte)
        dictEnd += 1
        if dictEnd - dictStart == dictionarySize {
