Fan.Sys.OutStream.writeBuf C# (CSharp) Méthode

writeBuf() public méthode

public writeBuf ( Buf buf ) : OutStream
buf Buf
Résultat OutStream
        public virtual OutStream writeBuf(Buf buf)
        {
            return writeBuf(buf, buf.remaining());
        }

Same methods

OutStream::writeBuf ( Buf buf, long n ) : OutStream

Usage Example

Exemple #1
0
 public virtual long pipe(OutStream output, Long toPipe, bool cls)
 {
     try
     {
         long bufSize = FanInt.Chunk.longValue();
         Buf  buf     = Buf.make(bufSize);
         long total   = 0;
         if (toPipe == null)
         {
             while (true)
             {
                 Long n = readBuf(buf.clear(), bufSize);
                 if (n == null)
                 {
                     break;
                 }
                 output.writeBuf(buf.flip(), buf.remaining());
                 total += n.longValue();
             }
         }
         else
         {
             long toPipeVal = toPipe.longValue();
             while (total < toPipeVal)
             {
                 if (toPipeVal - total < bufSize)
                 {
                     bufSize = toPipeVal - total;
                 }
                 Long n = readBuf(buf.clear(), bufSize);
                 if (n == null)
                 {
                     throw IOErr.make("Unexpected end of stream").val;
                 }
                 output.writeBuf(buf.flip(), buf.remaining());
                 total += n.longValue();
             }
         }
         return(total);
     }
     finally
     {
         if (cls)
         {
             close();
         }
     }
 }
All Usage Examples Of Fan.Sys.OutStream::writeBuf