code: public void writeLength() throws IOException {
          if (inputStream == null)
              throw new UnsupportedOperationException("writeLength() can only be called in a contructed PdfStream(InputStream,PdfWriter).");
          if (inputStreamLength == -1)
              throw new IOException("writeLength() can only be called after output of the stream body.");
          writer.addToBody(new PdfNumber(inputStreamLength), ref, false);
      }
docs: Writes the stream length to the <CODE>PdfWriter</CODE>.
  <p>
  This method must be called and can only be called if the constructor {@link #PdfStream(InputStream,PdfWriter)}
  is used to create the stream.
  @throws IOException on error
  @see #PdfStream(InputStream,PdfWriter)