public final class LCFile extends LCObject
LCObject.Hook
Modifier and Type | Field and Description |
---|---|
static String |
CLASS_NAME |
acl, className, endpointClassName, KEY_ACL, KEY_CLASSNAME, KEY_CREATED_AT, KEY_IGNORE_HOOKS, KEY_OBJECT_ID, KEY_UPDATED_AT, logger, objectId, operations, serverData, totallyOverwrite, UUID_LEN
Modifier | Constructor and Description |
---|---|
|
LCFile()
default constructor.
|
|
LCFile(String name,
byte[] data)
constructor with name and data.
|
|
LCFile(String name,
File localFile)
constructor with name and local file.
|
|
LCFile(String name,
String url)
constructor with name and external url.
|
|
LCFile(String name,
String url,
Map<String,Object> metaData)
constructor with name and external url.
|
protected |
LCFile(String name,
String url,
Map<String,Object> metaData,
boolean external) |
Modifier and Type | Method and Description |
---|---|
void |
addMetaData(String key,
Object val)
Add new meta data.
|
void |
clearMetaData()
Cleanup meta data.
|
void |
clearPathPrefix()
clear folder path.
|
boolean |
equals(Object o) |
Object |
get(String key)
Get file attribute.
|
String |
getBucket()
Get file bucket.
|
byte[] |
getData()
Get data in blocking mode.
|
io.reactivex.Observable<byte[]> |
getDataInBackground()
Get data in async mode.
|
InputStream |
getDataStream()
Get data stream in blocking mode.
|
io.reactivex.Observable<InputStream> |
getDataStreamInBackground()
Get data stream in async mode.
|
String |
getKey()
Get file key.
|
Map<String,Object> |
getMetaData()
Get file meta data.
|
Object |
getMetaData(String key)
Get file meta data.
|
String |
getMimeType()
Get file mime type.
|
String |
getName()
Get file name.
|
String |
getProvider()
Get file provider.
|
int |
getSize()
Get file size.
|
String |
getThumbnailUrl(boolean scaleToFit,
int width,
int height)
Returns a thumbnail image url using QiNiu endpoints.
|
String |
getThumbnailUrl(boolean scaleToFit,
int width,
int height,
int quality,
String fmt)
Returns a thumbnail image url using QiNiu endpoints.
|
String |
getUrl()
Get file url.
|
int |
hashCode() |
void |
increment(String key)
Increment file attribute.
|
void |
increment(String key,
Number value)
Increment file attribute.
|
void |
put(String key,
Object value)
Set file attribute.
|
void |
remove(String key)
Remove file attribute.
|
Object |
removeMetaData(String key)
Remove file meta data.
|
void |
save()
save to cloud.
|
void |
save(LCUser asAuthenticatedUser)
save to cloud
|
void |
saveEventually()
Save eventually(not supported).
|
void |
saveEventually(LCUser asAuthenticatedUser)
Save eventually(not supported).
|
io.reactivex.Observable<LCFile> |
saveInBackground()
save to cloud backend.
|
io.reactivex.Observable<LCFile> |
saveInBackground(boolean keepFileName)
save to cloud backend.
|
void |
saveInBackground(boolean keepFileName,
ProgressCallback progressCallback)
save to cloud backend.
|
io.reactivex.Observable<LCFile> |
saveInBackground(LCUser asAuthenticatedUser,
boolean keepFileName)
save to cloud in background.
|
void |
saveInBackground(LCUser asAuthenticatedUser,
boolean keepFileName,
ProgressCallback progressCallback)
save to cloud in background.
|
void |
saveInBackground(ProgressCallback progressCallback)
save to cloud backend.
|
void |
setMetaData(Map<String,Object> metaData)
Set file meta data.
|
void |
setMimeType(String mimeType)
Set file mime type.
|
void |
setName(String name)
Set file name.
|
void |
setPathPrefix(String path)
set folder path
|
static void |
setUploadHeader(String key,
String value) |
Map<String,Object> |
toMap()
Get map data of current file.
|
static LCFile |
withAbsoluteLocalPath(String name,
String absoluteLocalFilePath)
Generate File instance with local path.
|
static LCFile |
withFile(String name,
File file)
Generate File instance with local file.
|
static io.reactivex.Observable<LCFile> |
withObjectIdInBackground(String objectId)
Get AVFile instance from objectId.
|
abortOperations, add, addAll, addAllUnique, addNewOperation, addUnique, bitAnd, bitOr, bitXor, cast, containsKey, createWithoutData, createWithoutData, decrement, decrement, delete, delete, deleteAll, deleteAll, deleteAllInBackground, deleteAllInBackground, deleteEventually, deleteEventually, deleteInBackground, deleteInBackground, disableAfterHook, disableBeforeHook, extractCascadingObjects, extractUnsavedFiles, fetch, fetch, fetch, fetchIfNeeded, fetchIfNeededInBackground, fetchIfNeededInBackground, fetchIfNeededInBackground, fetchInBackground, fetchInBackground, fetchInBackground, generateACLFromServerData, generateCascadingSaveObjects, generateChangedParam, getACL, getBoolean, getBytes, getClassName, getCreatedAt, getCreatedAtString, getDate, getDouble, getInt, getJSONArray, getJSONObject, getLCFile, getLCGeoPoint, getLCObject, getList, getLong, getNumber, getObjectId, getQuery, getRelation, getRequestMethod, getRequestRawEndpoint, getServerData, getString, getUnsavedFiles, getUpdatedAt, getUpdatedAtString, getUuid, has, hasCircleReference, ignoreHook, internalClassName, internalGet, internalId, internalPut, isDataAvailable, isFetchWhenSave, onDataSynchronized, onSaveFailure, onSaveSuccess, parseLCObject, refresh, refresh, refresh, refreshInBackground, refreshInBackground, refreshInBackground, refreshInBackground, registerSubclass, removeAll, removeOperationForKey, resetAll, resetByRawData, resetServerData, saveAll, saveAll, saveAllInBackground, saveAllInBackground, saveInBackground, saveInBackground, saveInBackground, setACL, setClassName, setFetchWhenSave, setObjectId, toJSONObject, toJSONString, toString, validFieldName, verifyInternalId
public static final String CLASS_NAME
public LCFile()
public LCFile(String name, byte[] data)
name
- file name.data
- binary data.public LCFile(String name, File localFile)
name
- file name.localFile
- local file.public LCFile(String name, String url)
name
- file name.url
- external url.public LCFile(String name, String url, Map<String,Object> metaData)
name
- file nameurl
- external url.metaData
- additional attributes.public static io.reactivex.Observable<LCFile> withObjectIdInBackground(String objectId)
objectId
- file objectId.public String getName()
public void setName(String name)
name
- file name.public void setPathPrefix(String path)
path
- folder path. null or empty string equals to clearPathPrefix.public void clearPathPrefix()
public void setMetaData(Map<String,Object> metaData)
metaData
- meta data.public void addMetaData(String key, Object val)
key
- meta key.val
- meta value.public Object getMetaData(String key)
key
- meta key.public Object removeMetaData(String key)
key
- meta key.public void clearMetaData()
public int getSize()
public String getMimeType()
public void setMimeType(String mimeType)
mimeType
- mime type.public String getKey()
public String getBucket()
public String getUrl()
public String getProvider()
public void remove(String key)
public void increment(String key)
public String getThumbnailUrl(boolean scaleToFit, int width, int height)
scaleToFit
- scale param.width
- width.height
- height.getThumbnailUrl(boolean, int, int, int, String)
public String getThumbnailUrl(boolean scaleToFit, int width, int height, int quality, String fmt)
scaleToFit
- scale param.width
- widthheight
- heightquality
- quality.fmt
- format string.public void saveInBackground(boolean keepFileName, ProgressCallback progressCallback)
keepFileName
- whether keep file name in url or not.progressCallback
- progress callback.public void saveInBackground(LCUser asAuthenticatedUser, boolean keepFileName, ProgressCallback progressCallback)
asAuthenticatedUser
- explicit user for request authentication.keepFileName
- whether keep file name in url or not.progressCallback
- progress callback.
in general, this method should be invoked in lean engine.public void saveInBackground(ProgressCallback progressCallback)
progressCallback
- progress callback.public io.reactivex.Observable<LCFile> saveInBackground()
saveInBackground
in class LCObject
public void save(LCUser asAuthenticatedUser)
public io.reactivex.Observable<LCFile> saveInBackground(boolean keepFileName)
keepFileName
- whether keep file name in url or not.public void saveEventually() throws LCException
saveEventually
in class LCObject
LCException
- exception happened.
Because that file size is too big, cache the entire data will cost much disk capacity,
so we don't support this method at present.public void saveEventually(LCUser asAuthenticatedUser) throws LCException
saveEventually
in class LCObject
asAuthenticatedUser
- explicit user for request authentication.LCException
- exception happened.
Because that file size is too big, cache the entire data will cost much disk capacity,
so we don't support this method at present.public io.reactivex.Observable<LCFile> saveInBackground(LCUser asAuthenticatedUser, boolean keepFileName)
asAuthenticatedUser
- explicit user for request authentication.keepFileName
- whether keep file name in url or not.public byte[] getData()
public io.reactivex.Observable<byte[]> getDataInBackground()
public InputStream getDataStream() throws Exception
Exception
- for file not found or io problem.public io.reactivex.Observable<InputStream> getDataStreamInBackground()
public static LCFile withAbsoluteLocalPath(String name, String absoluteLocalFilePath) throws FileNotFoundException
name
- file nameabsoluteLocalFilePath
- local path.FileNotFoundException
- file not found.public static LCFile withFile(String name, File file) throws FileNotFoundException
name
- file name.file
- local file.FileNotFoundException
- file not found.Copyright © 2020, 美味书签(北京)信息技术有限公司 All rights reserved.