read() private method

private read ( ) : int
return int
示例#1
0
 private static void CopyStream(InputStream source, OutputStream destination)
 {
     sbyte[] b = new sbyte[0x1f40];
 Label_000B:
     try
     {
         int count = source.read(b, 0, b.Length);
         if (count > 0)
         {
             destination.write(b, 0, count);
             goto Label_000B;
         }
     }
     catch (Exception exception)
     {
         string message = exception.Message;
         goto Label_000B;
     }
 }
示例#2
0
 public virtual void copyStreams(InputStream @in, OutputStream @out, int buffersize)
 {
   byte[] numArray = new byte[buffersize];
   for (int index = @in.read(numArray); index > -1; index = @in.read(numArray))
     @out.write(numArray, 0, index);
 }
示例#3
0
 public int read(byte[] b)
 {
     return(@in.read(b, 0, b.Length));
 }
            void send(InputStream fis, string contenttype = "application/octet-stream")
            {
                string header =
                     "HTTP/1.1 200 OK\n";

                header += "Content-type: ";
                header += contenttype;
                header += "\n";

                //header += "Content-Length: " + fis.available() + "\n" +
                header += "\n";
                try
                {
                    var w = new OutputStreamWriter(output);
                    w.write(header);
                    w.flush();

                    sbyte[] buffer = new sbyte[1024];
                    int bytes = 0;

                    bytes = fis.read(buffer);
                    while (bytes != -1)
                    {
                        output.write(buffer, 0, bytes);
                        bytes = fis.read(buffer);
                    }

                }
                catch
                {
                }
            }