code: public void readFrom(InputStream input)
              throws ApplicationUnavailableException,
              AttachmentLengthExceededException {
          OutputStream output = null;
  
          try {
              output = getInstance().getWriter(this, getContentType());
              V1Util.copyStream(input, output);
              getInstance().commitWriteStream(this);
          } catch (IOException e) {
              throw new ApplicationUnavailableException(e);
          } finally {
              if (output != null) {
                  try {
                      output.close();
                  } catch (IOException e) {
                      // do nothing
                  }
              }
          }
      }
docs: Read the attachment's content from the input stream. Set the ContentType
  and Filename properties before calling this method.
  
  @param input Stream to read the content from.
  @throws ApplicationUnavailableException if appears any problem with
  connection to service.
  @throws AttachmentLengthExceededException if attachment is too long.