示例#1
0
        /// <exception cref="System.IO.IOException"></exception>
        protected virtual void Copy(IInputStream rawin, Socket4Adapter sock, bool update)
        {
            var @in       = new BufferedInputStream(rawin);
            var buffer    = new byte[BlobImpl.CopybufferLength];
            var bytesread = -1;

            while ((bytesread = rawin.Read(buffer)) >= 0)
            {
                sock.Write(buffer, 0, bytesread);
                if (update)
                {
                    _currentByte += bytesread;
                }
            }
            @in.Close();
        }
示例#2
0
 public virtual bool Write(Socket4Adapter sock)
 {
     if (null == sock)
     {
         throw new ArgumentNullException();
     }
     lock (sock)
     {
         try
         {
             sock.Write(PayLoad()._buffer);
             sock.Flush();
             return(true);
         }
         catch (Exception)
         {
             // TODO: .NET convert SocketException to Db4oIOException
             // and let Db4oIOException bubble up.
             //e.printStackTrace();
             return(false);
         }
     }
 }
示例#3
0
文件: MsgBlob.cs 项目: masroore/db4o
 /// <exception cref="System.IO.IOException"></exception>
 protected virtual void Copy(IInputStream rawin, Socket4Adapter sock, bool update)
 {
     var @in = new BufferedInputStream(rawin);
     var buffer = new byte[BlobImpl.CopybufferLength];
     var bytesread = -1;
     while ((bytesread = rawin.Read(buffer)) >= 0)
     {
         sock.Write(buffer, 0, bytesread);
         if (update)
         {
             _currentByte += bytesread;
         }
     }
     @in.Close();
 }
示例#4
0
文件: Msg.cs 项目: masroore/db4o
 public virtual bool Write(Socket4Adapter sock)
 {
     if (null == sock)
     {
         throw new ArgumentNullException();
     }
     lock (sock)
     {
         try
         {
             sock.Write(PayLoad()._buffer);
             sock.Flush();
             return true;
         }
         catch (Exception)
         {
             // TODO: .NET convert SocketException to Db4oIOException
             // and let Db4oIOException bubble up.
             //e.printStackTrace();
             return false;
         }
     }
 }