iTextSharp.text.pdf.FilterHandlers.Filter_RUNLENGTHDECODE.Decode C# (CSharp) Метод

Decode() публичный Метод

public Decode ( byte b, PdfName filterName, PdfObject decodeParams, PdfDictionary streamDictionary ) : byte[]
b byte
filterName PdfName
decodeParams PdfObject
streamDictionary PdfDictionary
Результат byte[]
            public byte[] Decode(byte[] b, PdfName filterName, PdfObject decodeParams, PdfDictionary streamDictionary)
            {
                // allocate the output buffer
                MemoryStream baos = new MemoryStream();
                sbyte dupCount = -1;
                for (int i = 0; i < b.Length; i++){
                    dupCount = (sbyte)b[i];
                    if (dupCount == -128) break; // this is implicit end of data

                    if (dupCount >= 0 && dupCount <= 127){
                        int bytesToCopy = dupCount+1;
                        baos.Write(b, i, bytesToCopy);
                        i+=bytesToCopy;
                    } else {
                        // make dupcount copies of the next byte
                        i++;
                        for (int j = 0; j < 1-(int)(dupCount);j++){
                            baos.WriteByte(b[i]);
                        }
                    }
                }
                return baos.ToArray();
            }
FilterHandlers.Filter_RUNLENGTHDECODE