public class ExoDocumentUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ExoDocumentUtils.DocumentInfo |
Modifier and Type | Field and Description |
---|---|
static String |
ALL_AUDIO_TYPE |
static String |
ALL_IMAGE_TYPE |
static String |
ALL_TEXT_TYPE |
static String |
ALL_VIDEO_TYPE |
static String |
AUDIO_TYPE |
static String[] |
FORBIDDEN_TYPES |
static String |
IMAGE_TYPE |
static String |
MSWORD_TYPE |
static String |
OPEN_POWERPOINT_TYPE |
static String |
OPEN_WORD_TYPE |
static String |
OPEN_XLS_TYPE |
static String |
PDF_TYPE |
static String |
POWERPOINT_TYPE |
static int |
ROTATION_0 |
static int |
ROTATION_180 |
static int |
ROTATION_270 |
static int |
ROTATION_90 |
static String |
TEXT_TYPE |
static String |
VIDEO_TYPE |
static String |
XLS_TYPE |
Constructor and Description |
---|
ExoDocumentUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
cleanupFilename(String originalName)
On Platform 4.1-M2, the upload service renames the uploaded file.
|
static boolean |
copyFile(String source,
String destination) |
static boolean |
createFolder(String destination) |
static boolean |
deleteFile(String url)
Delete remote folder or file
|
static boolean |
deleteLocalFiles(List<String> files)
Delete the Files at the given paths
|
static boolean |
didRequestPermission(android.app.Activity caller,
int permissionCode)
Check whether the application needs to request the permission required by the activity.
|
static ExoDocumentUtils.DocumentInfo |
documentFromContentUri(android.net.Uri contentUri,
android.content.Context context)
Gets a DocumentInfo with info coming from the document at the given URI.
|
static ExoDocumentUtils.DocumentInfo |
documentFromFileUri(android.net.Uri fileUri)
Gets a DocumentInfo with info coming from the file at the given URI.
|
static ExoDocumentUtils.DocumentInfo |
documentInfoFromUri(android.net.Uri document,
android.content.Context context)
Returns a DocumentInfo with info coming from the file at the given URI
|
static CompatibleFileOpen.FileOpenRequest |
fileOpen(android.content.Context context,
String fileType,
String filePath,
String fileName) |
static String |
fullURLofFile(String workSpaceName,
String url) |
static ExoFile |
getContentOfFolder(org.apache.http.HttpResponse response,
ExoFile file)
Get a folder with its sub-files and sub-folders.
Parse the XML response with format: |
static ArrayList<ExoFile> |
getDrives(org.apache.http.HttpResponse response)
Get the list of folders in a drive, from the HTTP response.
The response's body is an XM document that is parsed to extract the information of the folders. |
static ArrayList<ExoFile> |
getDrives(org.apache.http.HttpResponse response,
boolean isGroupDrive)
Get the list of folders in a drive, from the HTTP response.
The response's body is an XM document that is parsed to extract the information of the folders. |
static int |
getExifOrientationAngleFromFile(String filePath)
Get the EXIF orientation of the given file
|
static String |
getFileSize(long fileSize) |
static int |
getFreeMemory(String path) |
static String |
getFullFileType(String fileType) |
static int |
getIconFromType(String contentType) |
static String |
getLastPathComponent(String url) |
static String |
getParentUrl(String url) |
static ExoFile |
getPersonalDriveContent(android.content.Context context,
ExoFile file)
Get the content (files and folders) of the given folder.
|
static boolean |
isCallable(android.content.Context context,
String mimeType,
String url)
Check if the device has an application to open this type of file.
|
static boolean |
isContainSpecialChar(String str,
String charSet) |
static boolean |
isEnoughMemory(int fileSize) |
static boolean |
isForbidden(String mimeType)
Check whether the given Mime Type is forbidden.
|
static boolean |
moveFile(String source,
String destination) |
static boolean |
putFileToServerFromLocal(String url,
File fileManager,
String fileType) |
static boolean |
renameFolder(String source,
String destination) |
static android.graphics.Bitmap |
rotateBitmapByAngle(android.graphics.Bitmap source,
int angle)
Rotate the bitmap by a certain angle.
|
static android.graphics.Bitmap |
rotateBitmapToNormal(String filePath,
android.graphics.Bitmap source)
Rotate the bitmap at its correct orientation
|
static void |
setRepositoryHomeUrl(String userName,
String userHomeNodePath,
String domain) |
static boolean |
shouldDisplayExplanation(android.app.Activity activity,
int permCode)
Check whether the request for the specified permission should be explained to the user.
|
public static final String ALL_VIDEO_TYPE
public static final String ALL_AUDIO_TYPE
public static final String ALL_IMAGE_TYPE
public static final String ALL_TEXT_TYPE
public static final String IMAGE_TYPE
public static final String TEXT_TYPE
public static final String VIDEO_TYPE
public static final String AUDIO_TYPE
public static final String MSWORD_TYPE
public static final String OPEN_WORD_TYPE
public static final String PDF_TYPE
public static final String XLS_TYPE
public static final String OPEN_XLS_TYPE
public static final String POWERPOINT_TYPE
public static final String OPEN_POWERPOINT_TYPE
public static final String[] FORBIDDEN_TYPES
public static final int ROTATION_0
public static final int ROTATION_90
public static final int ROTATION_180
public static final int ROTATION_270
public static boolean isEnoughMemory(int fileSize)
public static int getFreeMemory(String path)
public static String getFileSize(long fileSize)
public static CompatibleFileOpen.FileOpenRequest fileOpen(android.content.Context context, String fileType, String filePath, String fileName)
public static boolean isForbidden(String mimeType)
ExoDocumentUtils.FORBIDDEN_TYPES
mimeType
- public static boolean isCallable(android.content.Context context, String mimeType, String url) throws IllegalArgumentException
context
- Context (mandatory)mimeType
- Mime Type to check (mandatory)url
- file url to guess the mime type from (optional)IllegalArgumentException
public static boolean putFileToServerFromLocal(String url, File fileManager, String fileType)
public static void setRepositoryHomeUrl(String userName, String userHomeNodePath, String domain)
public static ExoFile getPersonalDriveContent(android.content.Context context, ExoFile file) throws IOException
context
- file
- the folder to get content fromIOException
public static ArrayList<ExoFile> getDrives(org.apache.http.HttpResponse response)
ExoDocumentUtils.getDrives(response, false);
response
- the HttpResponse from where to extract the list of foldersExoDocumentUtils.getDrives(HttpResponse response, boolean
isGroupDrive)
public static ArrayList<ExoFile> getDrives(org.apache.http.HttpResponse response, boolean isGroupDrive)
response
- the HttpResponse from where to extract the list of foldersisGroupDrive
- if true the file's natural name will be createdpublic static ExoFile getContentOfFolder(org.apache.http.HttpResponse response, ExoFile file)
<Folder canAddChild="bool" canRemove="bool" currentFolder="Name" driveName="DriveName" hasChild="bool" name="Name" nodeType="nt" path="..." title="Title" titlePath="Title" workspaceName="Name"> <Folders> <Folder canAddChild="bool" canRemove="bool" currentFolder="Name" driveName="DriveName" hasChild="bool" name="Name" nodeType="nt" path="..." title="Title" titlePath="Title" workspaceName="Name"/> </Folders> <Files> <File canRemove="bool" creator="username" dateCreated="Date" dateModified="Date" name="doc.jpg" nodeType="nt" path="..." size="0" title="doc.jpg" workspaceName="Name"/> </Files> </Folder>Example URL:
https://SERVER/rest/managedocument/getFoldersAndFiles?driveName=Personal% 20Documents&workspaceName=collaboration¤tFolder=Public
response
- the response that contains the XML entityfile
- The folder to retrieve the content frompublic static int getIconFromType(String contentType)
public static boolean deleteFile(String url)
url
- the URL of the folder or file to deletepublic static boolean createFolder(String destination)
public static ExoDocumentUtils.DocumentInfo documentInfoFromUri(android.net.Uri document, android.content.Context context)
document
- the URI of a file or a contentcontext
- public static ExoDocumentUtils.DocumentInfo documentFromContentUri(android.net.Uri contentUri, android.content.Context context)
contentUri
- the content URI of the document (content:// ...)context
- public static ExoDocumentUtils.DocumentInfo documentFromFileUri(android.net.Uri fileUri)
fileUri
- the file URI (file:// ...)public static boolean deleteLocalFiles(List<String> files)
files
- a list of file pathspublic static String cleanupFilename(String originalName)
originalName
- the name to cleanpublic static int getExifOrientationAngleFromFile(String filePath)
filePath
- public static android.graphics.Bitmap rotateBitmapToNormal(String filePath, android.graphics.Bitmap source)
filePath
- the file where the bitmap is storedsource
- the bitmap itselfExoDocumentUtils.rotateBitmapByAngle(Bitmap, int)
public static android.graphics.Bitmap rotateBitmapByAngle(android.graphics.Bitmap source, int angle)
Matrix#postRotate(int)
source
- the bitmap to rotateangle
- the rotation anglepublic static boolean didRequestPermission(android.app.Activity caller, int permissionCode)
ActivityCompat.requestPermissions(Activity, String[], int)
).caller
- The activity that requires the permission. Must implement ActivityCompat.OnRequestPermissionsResultCallback
.permissionCode
- The code defined internally, e.g. ExoConstants.REQUEST_PICK_IMAGE_FROM_GALLERY
.public static boolean shouldDisplayExplanation(android.app.Activity activity, int permCode)
ActivityCompat.shouldShowRequestPermissionRationale(Activity, String)
.activity
- The activity that requires the permission.permCode
- The code defined internally, e.g. ExoConstants.REQUEST_PICK_IMAGE_FROM_GALLERY
.Copyright © 2003–2016 eXo Platform SAS. All rights reserved.