code: public void setFixedLengthStreamingMode(long contentLength) {
          if (connected) {
              throw new IllegalStateException("Already connected");
          }
          if (chunkLength != -1) {
              throw new IllegalStateException(
                  "Chunked encoding streaming mode set");
          }
          if (contentLength < 0) {
              throw new IllegalArgumentException("invalid content length");
          }
          fixedContentLengthLong = contentLength;
      }
docs: This method is used to enable streaming of a HTTP request body
  without internal buffering, when the content length is known in
  advance.
  
  <P> An exception will be thrown if the application attempts to write
  more data than the indicated content-length, or if the application
  closes the OutputStream before writing the indicated amount.
  
  <P> When output streaming is enabled, authentication and redirection
  cannot be handled automatically. A {@linkplain HttpRetryException} will
  be thrown when reading the response if authentication or redirection
  are required. This exception can be queried for the details of the
  error.
  
  <P> This method must be called before the URLConnection is connected.
  
  <P> The content length set by invoking this method takes precedence
  over any value set by {@link #setFixedLengthStreamingMode(int)}.
  
  @param  contentLength
  The number of bytes which will be written to the OutputStream.
  
  @throws  IllegalStateException
  if URLConnection is already connected or if a different
  streaming mode is already enabled.
  
  @throws  IllegalArgumentException
  if a content length less than zero is specified.
  
  @since 1.7