예제 #1
0
 public void close()
 {
     if (writer != null && bdata != null)
     {
         var bb    = cape.Buffer.allocate((long)1);
         var bbptr = bb;
         if (bcurr > 0)
         {
             var n = 0;
             for (n = bcurr; n < bsize; n++)
             {
                 cape.Buffer.setByte(bdata, (long)n, (byte)0);
             }
             writeCompleteBlock(bdata);
             cape.Buffer.setByte(bbptr, (long)0, (byte)(bsize - bcurr));
             writer.write(bb, -1);
         }
         else
         {
             cape.Buffer.setByte(bbptr, (long)0, (byte)0);
             writer.write(bb, -1);
         }
     }
     writer = null;
     cipher = null;
     bdata  = null;
 }
예제 #2
0
        public virtual bool print(string str)
        {
            if (object.Equals(str, null))
            {
                return(false);
            }
            var buffer = cape.String.toUTF8Buffer(str);

            if (buffer == null)
            {
                return(false);
            }
            var sz = (int)cape.Buffer.getSize(buffer);

            if (writer.write(buffer, -1) != sz)
            {
                return(false);
            }
            return(true);
        }