TrimList() public static method

Filters a list of Chunks, removing those which match the predicate
The original list is not altered
public static TrimList ( List list, ChunkPredicate predicateRemove ) : int
list List
predicateRemove ChunkPredicate
return int
Example #1
0
        /// <summary>Queues the chunk at the writer</summary>
        /// <param name="chunk">Chunk, ready for write</param>
        /// <param name="lazyOverwrite">Ovewrite lazily equivalent chunks</param>
        /// <remarks>Warning: the overwriting applies to equivalent chunks, see <c>ChunkPredicateEquiv</c>
        /// and will only make sense for queued (not yet writen) chunks
        /// </remarks>
        public void QueueChunk(PngChunk chunk, bool lazyOverwrite)
        {
            ChunksListForWrite cl = getChunkListW();

            if (ReadOnly)
            {
                throw new PngjException("cannot set chunk : readonly metadata");
            }
            if (lazyOverwrite)
            {
                ChunkHelper.TrimList(cl.GetQueuedChunks(), new ChunkPredicateEquiv(chunk));
            }
            cl.Queue(chunk);
        }