/// <summary>This constructor is for reusing ByteArrayOutputStreams of indexStream and outputStream.</summary>
        /// <remarks>
        /// This constructor is for reusing ByteArrayOutputStreams of indexStream and outputStream.
        /// NOTE Only for internal use in PdfWriter!
        /// </remarks>
        /// <param name="prev">previous PdfObjectStream.</param>
        internal PdfObjectStream(iText.Kernel.Pdf.PdfObjectStream prev)
            : this(prev.GetIndirectReference().GetDocument())
        {
            ByteArrayOutputStream prevOutputStream = (ByteArrayOutputStream)prev.GetOutputStream().GetOutputStream();

            prevOutputStream.JReset();
            InitOutputStream(prevOutputStream);
            ByteArrayOutputStream prevIndexStream = ((ByteArrayOutputStream)indexStream.GetOutputStream());

            prevIndexStream.JReset();
            indexStream = new PdfOutputStream(prevIndexStream);
        }