示例#1
0
        copyRdr2Wtr(Reader rdr, Writer wtr)
        {
            if (cbuff == null)
            {
                lock (this)
                {
                    { if (cbuff == null)
                      {
                          cbuff = new char[4096];
                      }
                    }
                }
            }

            try
            {
                lock (cbuff)
                {
                    for (int len = rdr.read(cbuff); len >= 0; len = rdr.read(cbuff))
                    {
                        wtr.write(cbuff, 0, len);
                    }
                }

                rdr.close();
                wtr.flush();
            }
            catch (Exception ex)
            {
                try { rdr.close(); }
                catch (Exception /* ignore */) { }
                try { wtr.flush(); }
                catch (Exception /* ignore */) { }
                throw SqlEx.get(ERR_GC4007_BLOB_IO, ex);
            }

            return;
        }         // copyRdr2Wtr
示例#2
0
        /*
        ** Name: get
        **
        ** Description:
        **	Write the current data value to a Writer stream.
        **	The current data value is consumed.  The Writer
        **	stream is not closed but will be flushed.
        **
        **	Note: the value returned when the data value is
        **	NULL is not well defined.
        **
        ** Input:
        **	wtr	Writer to receive data value.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	void.
        **
        ** History:
        **	 1-Dec-03 (gordy)
        **	    Created.
        */
        public override void get(Writer wtr)
        {
            Object stream = getStream();

            if (stream != null)
            {
                if (stream is InputStream)
                    copyRdr2Wtr(cnvtIS2Rdr((InputStream)stream), wtr);
                else
                    if (stream is Reader)
                        copyRdr2Wtr((Reader)stream, wtr);
                    else
                        throw SqlEx.get(ERR_GC401A_CONVERSION_ERR);
            }
            return;
        }
示例#3
0
 /*
 ** Name: get
 **
 ** Description:
 **	Write the current data value to a Writer stream.
 **	The current data value is consumed.  The Writer
 **	stream is not closed but will be flushed.
 **
 **	Note: the value returned when the data value is
 **	NULL is not well defined.
 **
 ** Input:
 **	wtr	Writer to receive data value.
 **
 ** Output:
 **	None.
 **
 ** Returns:
 **	void.
 **
 ** History:
 **	 1-Dec-03 (gordy)
 **	    Created.
 */
 public virtual void get(Writer wtr)
 {
     copyRdr2Wtr((Reader)getStream(), wtr);
     return;
 }
示例#4
0
        /*
        ** Name: coyRdr2Wtr
        **
        ** Description:
        **	Writes the contents of a Reader stream to a Writer stream.
        **	The Reader stream is closed.  The Writer stream is flushed
        **	but not closed.
        **
        ** Input:
        **	rdr	Reader stream.
        **	wtr	Writer stream.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	void.
        **
        ** History:
        **	 1-Dec-03 (gordy)
        **	    Created.
        */
        protected void copyRdr2Wtr(Reader rdr, Writer wtr)
        {
            if (cbuff == null)
                lock (this)
                {
                    { if (cbuff == null)  cbuff = new char[4096]; }
                }

            try
            {
                lock (cbuff)
                {
                    for (int len = rdr.read(cbuff); len >= 0; len = rdr.read(cbuff))
                        wtr.write(cbuff, 0, len);
                }

                rdr.close();
                wtr.flush();
            }
            catch (Exception ex)
            {
                try { rdr.close(); }
                catch (Exception /* ignore */ ) { }
                try { wtr.flush(); }
                catch (Exception /* ignore */ ) { }
                throw SqlEx.get(ERR_GC4007_BLOB_IO, ex);
            }

            return;
        }