code: public void getRepresentationContent(String representationHint, String assetPath, OutputStream output) {
  
          List<Representation> reps = this.getInfoWithRepresentations(representationHint).getRepresentations();
          if (reps.size() < 1) {
              throw new BoxAPIException("No matching representations found");
          }
          Representation representation = reps.get(0);
          String repState = representation.getStatus().getState();
  
          if (repState.equals("viewable") || repState.equals("success")) {
  
              this.makeRepresentationContentRequest(representation.getContent().getUrlTemplate(),
                      assetPath, output);
              return;
          } else if (repState.equals("pending") || repState.equals("none")) {
  
              String repContentURLString = null;
              while (repContentURLString == null) {
                  repContentURLString = this.pollRepInfo(representation.getInfo().getUrl());
              }
  
              this.makeRepresentationContentRequest(repContentURLString, assetPath, output);
              return;
  
          } else if (repState.equals("error")) {
  
              throw new BoxAPIException("Representation had error status");
          } else {
  
              throw new BoxAPIException("Representation had unknown status");
          }
  
      }
docs: Fetches the contents of a file representation with asset path and writes them to the provided output stream.
  @see <a href=https://developer.box.com/reference#section-x-rep-hints-header>X-Rep-Hints Header</a>
  @param representationHint the X-Rep-Hints query for the representation to fetch.
  @param assetPath the path of the asset for representations containing multiple files.
  @param output the output stream to write the contents to.