title: Use box java sdk to download an item without knowing if it's a file or a folder
body: <p>With the ID of an item stored on box, you can download it if it's a file, or download its contents if it's a folder. Either way it seems you need to know what sort of thing you're downloading in order to access it, doing either <code>BoxFile file = new BoxFile(api, id);</code> or <code>BoxFolder folder = new BoxFolder(api, id);</code> before handling the actual download.</p>
  
  <p>I was hoping to be able to do something like</p>
  
  <pre><code>BoxItem boxItem = new BoxItem(api, id);
  if (boxItem instanceof BoxFile) {
      // download file
  } else if (boxItem instanceof BoxFolder) {
      // download all files in folder
  }
  </code></pre>
  
  <p>sort of like <a href="https://github.com/box/box-java-sdk/blob/master/doc/folders.md#get-a-folders-items" rel="nofollow">the example in the docs of downloading a folder's contents</a>. However, in that case the ID is that of a specific folder, whereas my ID is for either a folder or a file in the root folder, and I don't want to loop through all of the root folder's contents. And, anyway, <code>BoxItem</code> cannot be instantiated.</p>
  
  <p>How can I tell ahead of time whether I'm downloading a file or a folder, with just the item's ID? If not, is there a way to download the item anyway?</p>