private static void ReadModule(DocumentInputStream dis, String name, ModuleMap modules) { Module module = modules.Get(name); // TODO Refactor this to fetch dir then do the rest if (module == null) { // no DIR stream with offsets yet, so store the compressed bytes for later module = new Module(); modules.Put(name, module); module.Read(dis); } else { if (module.offset == null) { //This should not happen. bug 59858 throw new IOException("Module offset for '" + name + "' was never Read."); } // we know the offset already, so decompress immediately on-the-fly long skippedBytes = dis.Skip(module.offset.Value); if (skippedBytes != module.offset) { throw new IOException("tried to skip " + module.offset + " bytes, but actually skipped " + skippedBytes + " bytes"); } InputStream stream = new RLEDecompressingInputStream(dis); module.Read(stream); stream.Close(); } }
private byte[] NextChunk() { int index = (int)(_pos >> 12); byte[] blockKey = new byte[4]; LittleEndian.PutInt(blockKey, 0, index); byte[] iv = _ag.GenerateIv(_ag.Info.Header.Algorithm, _ag.Info.Header.KeySalt, blockKey); //_cipher.Mode = CipherMode. _cipher.Key = _ag.SecretKey; _cipher.IV = iv; if (_lastIndex != index) { _stream.Skip((index - _lastIndex) << 12); } byte[] block = new byte[Math.Min(_stream.Available(), 4096)]; _stream.ReadFully(block); _lastIndex = index + 1; throw new NotImplementedException(); //return _cipher.doFinal(block); Leon }