/// <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(); }
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); } } }
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; } } }