code: public CmsFile readFile(CmsResource resource) throws CmsException {
  
          // test if we already have a file
          if (resource instanceof CmsFile) {
              // resource is already a file
              CmsFile file = (CmsFile)resource;
              if ((file.getContents() != null) && (file.getContents().length > 0)) {
                  // file has the contents already available
                  return file;
              }
          }
  
          return m_securityManager.readFile(m_context, resource);
      }
docs: Reads a file resource (including it's binary content) from the VFS,
  for the given resource (this may also be an historical version of the resource).<p>
  
  In case the input {@link CmsResource} object already is a {@link CmsFile} with contents
  available, it is casted to a file and returned unchanged. Otherwise the file is read
  from the VFS.<p>
  
  In case you do not need the file content,
  use <code>{@link #readResource(String)}</code> or
  <code>{@link #readResource(String, CmsResourceFilter)}</code> instead.<p>
  
  No resource filter is applied when reading the resource, since we already have
  a full resource instance and assume we just want the content for that instance.
  In case you need to apply a filter, use {@link #readFile(String, CmsResourceFilter)} instead.<p>
  
  @param resource the resource to read
  
  @return the file resource that was read
  
  @throws CmsException if the file resource could not be read for any reason
  
  @see #readFile(String)
  @see #readFile(String, CmsResourceFilter)