Package java.io

Examples of java.io.DataOutputStream.writeBytes()


            {
               log.trace("HTTP code=" + httpCode + ", Content-Length: " + bytes.length);
               // The HTTP 1.0 header
               out.writeBytes("HTTP/1.0 " + httpCode + "\r\n");
               out.writeBytes("Content-Length: " + bytes.length + "\r\n");
               out.writeBytes("Content-Type: " + getMimeType(filePath));
               out.writeBytes("\r\n\r\n");
               // The response body
               out.write(bytes);
               out.flush();
            }
View Full Code Here


               log.trace("HTTP code=" + httpCode + ", Content-Length: " + bytes.length);
               // The HTTP 1.0 header
               out.writeBytes("HTTP/1.0 " + httpCode + "\r\n");
               out.writeBytes("Content-Length: " + bytes.length + "\r\n");
               out.writeBytes("Content-Type: " + getMimeType(filePath));
               out.writeBytes("\r\n\r\n");
               // The response body
               out.write(bytes);
               out.flush();
            }
            catch (IOException ie)
View Full Code Here

         {
            try
            {
               log.trace("HTTP code=404, " + e.getMessage());
               // Write out error response
               out.writeBytes("HTTP/1.0 404 Not Found\r\n");
               out.writeBytes("Content-Type: text/html\r\n\r\n");
               out.flush();
            }
            catch (IOException ex)
            {
View Full Code Here

            try
            {
               log.trace("HTTP code=404, " + e.getMessage());
               // Write out error response
               out.writeBytes("HTTP/1.0 404 Not Found\r\n");
               out.writeBytes("Content-Type: text/html\r\n\r\n");
               out.flush();
            }
            catch (IOException ex)
            {
               // Ignore
View Full Code Here

        }
        if (doOutput) {
            setRequestProperty("Content-length", "" + output.size()); //$NON-NLS-1$ //$NON-NLS-2$
        }

        data.writeBytes((doOutput ? "POST" : "GET") + " " + (url.getFile().equals("") ? "/" : url.getFile()) + " HTTP/1.0\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$

        for (int i = 0; i < requestKeys.size(); ++i) {
            String key = (String) requestKeys.elementAt(i);
            if (!key.startsWith("Proxy-")) { //$NON-NLS-1$
                data.writeBytes(key + ": " + requestValues.elementAt(i) + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

        data.writeBytes((doOutput ? "POST" : "GET") + " " + (url.getFile().equals("") ? "/" : url.getFile()) + " HTTP/1.0\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$

        for (int i = 0; i < requestKeys.size(); ++i) {
            String key = (String) requestKeys.elementAt(i);
            if (!key.startsWith("Proxy-")) { //$NON-NLS-1$
                data.writeBytes(key + ": " + requestValues.elementAt(i) + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }
        data.writeBytes("\r\n"); //$NON-NLS-1$
        data.flush();
        if (doOutput) {
View Full Code Here

            String key = (String) requestKeys.elementAt(i);
            if (!key.startsWith("Proxy-")) { //$NON-NLS-1$
                data.writeBytes(key + ": " + requestValues.elementAt(i) + "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }
        data.writeBytes("\r\n"); //$NON-NLS-1$
        data.flush();
        if (doOutput) {
            output.writeTo(out);
        }
        out.flush();
View Full Code Here

      // open a stream which can write to the url
      DataOutputStream dstream = new DataOutputStream(c.getOutputStream());

      // write content to the server, begin with the tag that says a content element is comming
      dstream.writeBytes("--AXi93A\r\n");

     
      System.out.println("data length:" + data.length);
     
      // discribe the content
View Full Code Here

     
      System.out.println("data length:" + data.length);
     
      // discribe the content
      dstream.writeBytes("Content-Disposition: form-data; name=\"Filedata\"; filename=\""+fileName+"\" \r\nContent-Type: image/jpeg\r\nContent-Transfer-Encoding: binary\r\n");
      dstream.write(data, 0, data.length);

      // close the multipart form request
      dstream.writeBytes("\r\n--AXi93A--\r\n\r\n");
      dstream.flush();
View Full Code Here

      // discribe the content
      dstream.writeBytes("Content-Disposition: form-data; name=\"Filedata\"; filename=\""+fileName+"\" \r\nContent-Type: image/jpeg\r\nContent-Transfer-Encoding: binary\r\n");
      dstream.write(data, 0, data.length);

      // close the multipart form request
      dstream.writeBytes("\r\n--AXi93A--\r\n\r\n");
      dstream.flush();
      dstream.close();
     
      System.out.println("sendJpegToUrl complete ");
     
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.