Rectangle 27 0

android EOFException and FileNotFoundException in HttpURLConnection getInputStream()?


I checked conn.getResponseCode() and get a 403. The exception might be due to that.

Note
Rectangle 27 0

android EOFException and FileNotFoundException in HttpURLConnection getInputStream()?


if(postData != null){
                byte[] requestContent = getQuery(postData);
                conn.setDoOutput(true);
// Specify content type
                conn.setRequestProperty("Content-Type", mRequestContentType);
                conn.setRequestProperty("Content-Length",
                    Integer.toString(requestContent.length));
                conn.setFixedLengthStreamingMode(requestContent.length);
                OutputStream os = conn.getOutputStream();
                BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8"));
                writer.write(requestContent);
                writer.close();
                os.close();
            }
Note
Rectangle 27 0

android EOFException and FileNotFoundException in HttpURLConnection getInputStream()?


if(postData != null){
                byte[] requestContent = getQuery(postData);
                conn.setDoOutput(true);
// Specify content type
                conn.setRequestProperty("Content-Type", mRequestContentType);
                conn.setRequestProperty("Content-Length",
                    Integer.toString(requestContent.length));
                conn.setFixedLengthStreamingMode(requestContent.length);
                OutputStream os = conn.getOutputStream();
                BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8"));
                writer.write(requestContent);
                writer.close();
                os.close();
            }
Note