title: how do i count byteCount in read method of InputStream
body: <p>i want to download a file through InputStream from some offSet,
  i know that i can do this by read method of InputStream but it requires a parameter byteCount
  but i don't know how to calculate byteCount for read Method</p>
  
  <p><strong>My Code is</strong></p>
  
  <pre><code>         try {
                  URL url;
                  url = new URL(uri);
                  HttpURLConnection c = (HttpURLConnection) url
                          .openConnection();
                  c.setConnectTimeout(1000000);
                  c.connect();
                  int lenghtOfFile = c.getContentLength();
                  Log.i("fileSize", lenghtOfFile + "");
                  File file = new File(
                          Environment.getExternalStorageDirectory() + "/"
                                  + Environment.DIRECTORY_DOWNLOADS);
                  file.mkdirs();
                  File outputFile = new File(file, "4k1.jpg");
                  FileOutputStream fos = new FileOutputStream(outputFile);
                  Log.v("Place", "trying...");
                  InputStream is = c.getInputStream();
                  Log.v("errorPart", c.getURL().toString());
                  if (c.getURL().toString().contains("404"))
                      Log.v("Error", "404 Error");
                  Log.v("Place", "1st attempt success");
                  byte[] buffer = new byte[1024];
                  int len1 = 0;
                  Log.v("Place", "Download started!");
                  int on = 0;
                      while ((len1 = is.read(buffer)) != -1) {
                          fos.write(buffer, 0, len1);
                          Log.v("is", "running "  + len1);
                      }
                  Log.v("Place", "Download Finished!");
                  fos.close();
                  is.close();
              } catch (Exception e) {
                  e.printStackTrace();
              }    
  </code></pre>
  
  <p>Please try to explain your answer, i am newbiee</p>