Esempio n. 1
0
            internal BlobOutputStream(BlobImpl first, bool multisession)
            {
                first.Load();
                this.first = first;
                this.multisession = multisession;
                int size = first.size;
                while (first.next != null)
                {
                    size -= first.body.Length;
                    BlobImpl prev = first;
                    first = first.next;
                    first.Load();
                    prev.Invalidate();
                    prev.next = null;
                    pos = 0;
                }

                curr = first;
                pos = size;
            }
Esempio n. 2
0
            public override int Read(byte[] b, int off, int len)
            {
                if (len > rest)
                    len = rest;

                int beg = off;
                while (len > 0)
                {
                    if (pos == curr.body.Length)
                    {
                        BlobImpl prev = curr;
                        curr = curr.next;
                        curr.Load();
                        prev.Invalidate();
                        prev.next = null;
                        pos = 0;
                    }

                    int n = len > curr.body.Length - pos ? curr.body.Length - pos : len;
                    Array.Copy(curr.body, pos, b, off, n);
                    pos += n;
                    off += n;
                    len -= n;
                    rest -= n;
                }

                return off - beg;
            }
Esempio n. 3
0
            //UPGRADE_NOTE: The equivalent of method 'java.io.InputStream.skip' is not an override method.
            public long Skip(long offs)
            {
                if (offs > rest)
                {
                    offs = rest;
                }

                int len = (int) offs;
                while (len > 0)
                {
                    if (pos == curr.body.Length)
                    {
                        BlobImpl prev = curr;
                        curr = curr.next;
                        curr.Load();
                        prev.Invalidate();
                        prev.next = null;
                        pos = 0;
                    }

                    int n = len > curr.body.Length - pos ? curr.body.Length - pos : len;
                    pos += n;
                    len -= n;
                    rest -= n;
                }

                return offs;
            }
Esempio n. 4
0
 protected internal BlobInputStream(BlobImpl first)
 {
     first.Load();
     curr = first;
     rest = first.size;
 }