public class KitStorageUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
KitStorageUtils.MediaType |
Constructor and Description |
---|
KitStorageUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copy(java.io.FileInputStream ist,
java.io.FileOutputStream ost) |
android.net.Uri |
getContentUri(int type,
java.lang.String id) |
java.io.InputStream |
getFileInputStreamWithUri(android.content.Context pContext,
android.net.Uri pUri) |
static java.lang.String |
getFileSavePath(android.content.Context context) |
static java.lang.String |
getImageSavePath(android.content.Context context) |
static java.lang.String |
getImgMimeType(java.io.File imgFile) |
static java.lang.String |
getSavePath(android.content.Context context,
java.lang.String type,
int res) |
static java.lang.String |
getVideoSavePath(android.content.Context context) |
static android.net.Uri |
insertImageIntoMediaStore(android.content.Context context,
java.lang.String fileName,
java.lang.String mimeType) |
static android.net.Uri |
insertVideoIntoMediaStore(android.content.Context context,
java.lang.String fileName) |
static boolean |
isBuildAndTargetForQ(android.content.Context context) |
static boolean |
isScopedStorageMode(android.content.Context context) |
static void |
read(android.os.ParcelFileDescriptor parcelFileDescriptor,
java.io.File dst) |
static boolean |
saveMediaToPublicDir(android.content.Context context,
java.io.File file,
java.lang.String type) |
static boolean |
saveMediaToPublicDir(android.content.Context context,
java.io.File file,
java.lang.String outputFileName,
java.lang.String type) |
static void |
updatePhotoMedia(java.io.File file,
android.content.Context context) |
static void |
writeToPublicDir(java.io.File pFile,
android.os.ParcelFileDescriptor pParcelFileDescriptor) |
public static boolean isScopedStorageMode(android.content.Context context)
public static boolean isBuildAndTargetForQ(android.content.Context context)
public static java.lang.String getImageSavePath(android.content.Context context)
public static java.lang.String getVideoSavePath(android.content.Context context)
public static java.lang.String getFileSavePath(android.content.Context context)
public static java.lang.String getSavePath(android.content.Context context, java.lang.String type, int res)
public static void updatePhotoMedia(java.io.File file, android.content.Context context)
public static android.net.Uri insertImageIntoMediaStore(android.content.Context context, java.lang.String fileName, java.lang.String mimeType)
public static android.net.Uri insertVideoIntoMediaStore(android.content.Context context, java.lang.String fileName)
public static void writeToPublicDir(java.io.File pFile, android.os.ParcelFileDescriptor pParcelFileDescriptor)
public static void read(android.os.ParcelFileDescriptor parcelFileDescriptor, java.io.File dst) throws java.io.IOException
java.io.IOException
public static void copy(java.io.FileInputStream ist, java.io.FileOutputStream ost)
public static java.lang.String getImgMimeType(java.io.File imgFile)
public android.net.Uri getContentUri(int type, java.lang.String id)
type
- MediaStore类型,0:Images,1:Video,2:Audioid
- 通过扫描获取到的MediaStore."xxx".Media._IDpublic java.io.InputStream getFileInputStreamWithUri(android.content.Context pContext, android.net.Uri pUri)
public static boolean saveMediaToPublicDir(android.content.Context context, java.io.File file, java.lang.String type)
context
- 上下文file
- 文件type
- KitStorageUtils.MediaTypepublic static boolean saveMediaToPublicDir(android.content.Context context, java.io.File file, java.lang.String outputFileName, java.lang.String type)
context
- 上下文file
- 文件outputFileName
- 输出的文件名,不包含路径type
- KitStorageUtils.MediaType