Ejemplo n.º 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();
        }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 3
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();
 }
Ejemplo n.º 4
0
Archivo: Msg.cs Proyecto: 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;
         }
     }
 }