}
public DocumentListEntry uploadFile(byte[] mediaBytes, String mediaType, String title, String folder) throws IOException, ServiceException, URISyntaxException {
DocumentListEntry newEntry = new DocumentListEntry();
newEntry.setTitle(new PlainTextConstruct(title));
newEntry.setMediaSource(new MediaByteArraySource(mediaBytes, mediaType));
DocumentListEntry folderEntry = findDocumentFolderEntry(folder);
if (folderEntry != null) {
return documentsService.insert(new URL(((MediaContent) folderEntry.getContent()).getUri()), newEntry);
}
return documentsService.insert(documentsFeedUri, newEntry);