Show / Hide Table of Contents

Class Blob

A class representing an arbitrary piece of binary data

Inheritance
object
Blob
Implements
IJSON
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: Couchbase.Lite
Assembly: Couchbase.Lite.dll
Syntax
public sealed class Blob : IJSON

Constructors

| Improve this Doc View Source

Blob(string, byte[])

Creates a blob given a type and in memory content

Declaration
public Blob(string contentType, byte[] content)
Parameters
Type Name Description
string contentType

The binary type of the blob

byte[] content

The content of the blob

Exceptions
Type Condition
ArgumentNullException

Thrown if content is null

| Improve this Doc View Source

Blob(string, Stream)

Creates a blob given a type and streaming content

Declaration
public Blob(string contentType, Stream stream)
Parameters
Type Name Description
string contentType

The binary type of the blob

Stream stream

The stream containing the blob content

Exceptions
Type Condition
ArgumentNullException

Thrown if stream is null

| Improve this Doc View Source

Blob(string, Uri)

Creates an blob given a type and a URL to a file

Declaration
public Blob(string contentType, Uri fileUrl)
Parameters
Type Name Description
string contentType

The binary type of the blob

Uri fileUrl

The url to the file to read

Exceptions
Type Condition
ArgumentNullException

Thrown if fileUrl is null

ArgumentException

Thrown if fileUrl is not a file based URL

Properties

| Improve this Doc View Source

Content

Gets the contents of the blob as an in-memory array

Declaration
[JsonIgnore]
public byte[] Content { get; }
Property Value
Type Description
byte[]
Exceptions
Type Condition
InvalidOperationException

Thrown if this blob has no associated data (unusual)

| Improve this Doc View Source

ContentStream

Gets the contents of the blob as a Stream

Declaration
[JsonIgnore]
public Stream ContentStream { get; }
Property Value
Type Description
Stream
Remarks

The caller is responsible for disposing the Stream when finished with it.

| Improve this Doc View Source

ContentType

Gets the content type of the blob

Declaration
[JsonProperty("content_type")]
public string ContentType { get; }
Property Value
Type Description
string
| Improve this Doc View Source

Digest

Gets the digest of the blob, once it is saved

Declaration
[JsonProperty("digest")]
public string Digest { get; }
Property Value
Type Description
string
| Improve this Doc View Source

Length

Gets the length of the data that the blob contains

Declaration
[JsonProperty("length")]
public int Length { get; }
Property Value
Type Description
int
| Improve this Doc View Source

Properties

Gets the metadata of the blob instance

Declaration
[JsonIgnore]
public IReadOnlyDictionary<string, object> Properties { get; }
Property Value
Type Description
IReadOnlyDictionary<string, object>
| Improve this Doc View Source

Type

Declaration
[JsonProperty("@type")]
public string Type { get; }
Property Value
Type Description
string

Methods

| Improve this Doc View Source

Equals(object)

Determines whether the specified object is equal to the current object.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj

The object to compare with the current object.

Returns
Type Description
bool

true if the specified object is equal to the current object; otherwise, false.

Overrides
object.Equals(object)
| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
int
Overrides
object.GetHashCode()
| Improve this Doc View Source

IsBlob(IDictionary<string, object>)

Return whether the given dictionary represents Blob or not

Declaration
public static bool IsBlob(IDictionary<string, object> blobDict)
Parameters
Type Name Description
IDictionary<string, object> blobDict

JSON Dictionary represents in the Blob : Key | Value | Mandatory | Description

@type | constant string “blob” | Yes | Indicate Blob data type. content_type | String | No | Content type ex. text/plain. length | Number | No | Binary length of the Blob in bytes. digest | String | Yes | The cryptographic digest of the Blob’s content.

Returns
Type Description
bool

Return true if the given dictionary represents Blob, otherwise return false

| Improve this Doc View Source

ToJSON()

Converts this object to JSON format string.

Declaration
public string ToJSON()
Returns
Type Description
string

The contents of this object in JSON format string

Exceptions
Type Condition
NotSupportedException

Thrown if ToJSON is called from MutableDocument,
MutableDictionaryObject, or MutableArrayObject

| Improve this Doc View Source

ToString()

Returns a string that represents the current object.

Declaration
public override string ToString()
Returns
Type Description
string

A string that represents the current object.

Overrides
object.ToString()

Implements

IJSON
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX