Class FLEncoder
- java.lang.Object
-
- com.couchbase.lite.internal.core.C4NativePeer
-
- com.couchbase.lite.internal.fleece.FLEncoder
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
JSONEncoder
public abstract class FLEncoder extends C4NativePeer
Represent the encoder object whose ref is passed as a parameter or returned returned by the Core "init" call. The caller takes ownership of the "managed" version's peer and must call the close() method to release it. The "unmanaged" version's peer belongs to Core: it will be release by the native code.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
beginArray(long reserve)
boolean
beginDict(long reserve)
abstract void
close()
boolean
endArray()
boolean
endDict()
byte[]
finish()
FLSliceResult
finish2()
FLSliceResult
finish2Unmanaged()
Object
getArg(String key)
static FLEncoder
getManagedEncoder()
static FLEncoder
getUnmanagedEncoder(long peer)
void
reset()
FLEncoder
setArg(String key, Object arg)
String
toString()
boolean
write(List<?> list)
boolean
write(Map<String,Object> map)
boolean
writeData(byte[] value)
boolean
writeKey(String slice)
boolean
writeNull()
boolean
writeString(String value)
boolean
writeValue(Object value)
-
-
-
Method Detail
-
getUnmanagedEncoder
@NonNull public static FLEncoder getUnmanagedEncoder(long peer)
-
getManagedEncoder
@NonNull public static FLEncoder getManagedEncoder()
-
toString
@NonNull public String toString()
- Overrides:
toString
in classC4NativePeer
-
close
public abstract void close()
-
writeNull
public boolean writeNull()
-
writeString
public boolean writeString(String value)
-
writeData
public boolean writeData(byte[] value)
-
beginDict
public boolean beginDict(long reserve)
-
endDict
public boolean endDict()
-
beginArray
public boolean beginArray(long reserve)
-
endArray
public boolean endArray()
-
writeKey
public boolean writeKey(String slice)
-
writeValue
public boolean writeValue(@Nullable Object value)
-
write
public boolean write(@Nullable List<?> list)
-
reset
public void reset()
-
finish
@NonNull public byte[] finish() throws LiteCoreException
- Throws:
LiteCoreException
-
finish2
@NonNull public FLSliceResult finish2() throws LiteCoreException
- Throws:
LiteCoreException
-
finish2Unmanaged
@NonNull public FLSliceResult finish2Unmanaged() throws LiteCoreException
- Throws:
LiteCoreException
-
-