Saltar para o conteúdo principal
Versão: Próximo

Blob

The Blob class lets you create and manipulate blob objects (4D.Blob).

Resumo

4D.Blob.new() : 4D.Blob
4D.Blob.new( blobScal : Blob ) : 4D.Blob
4D.Blob.new( blobObj : 4D.Blob ) : 4D.Blob

creates a new 4D.Blob object optionally encapsulating a copy of the data from another blob (scalar blob or 4D.Blob)
.size : Real
returns the size of a 4D.Blob, expressed in bytes.
.slice() : 4D.Blob
.slice( start : Real ) : 4D.Blob
.slice( start : Real; end : Real ) : 4D.Blob

creates and returns a 4D.Blob that references data from a subset of the blob on which it's called. The original blob is not altered.

4D. Blob.new()

História
ReleaseMudanças
19 R2Adicionado

4D.Blob.new() : 4D.Blob
4D.Blob.new( blobScal : Blob ) : 4D.Blob
4D.Blob.new( blobObj : 4D.Blob ) : 4D.Blob

ParâmetroTipoDescrição
blobBlob or 4D. Blob->Blob a copiar
Resultados4D. Blob<-Novo 4D.Blob

Descrição

4D.Blob.new creates a new 4D.Blob object optionally encapsulating a copy of the data from another blob (scalar blob or 4D.Blob).

If the blob parameter is omitted, the method returns an empty 4D.Blob.

.size

.size : Real

Descrição

The .size property returns the size of a 4D.Blob, expressed in bytes.

.slice()

História
ReleaseMudanças
19 R2Adicionado

.slice() : 4D.Blob
.slice( start : Real ) : 4D.Blob
.slice( start : Real; end : Real ) : 4D.Blob

ParâmetroTipoDescrição
startReal->index of the first byte to include in the new 4D.Blob.
endReal->index of the first byte that will not be included in the new 4D.Blob
Resultados4D. Blob<-Novo 4D.Blob

Descrição

.slice() creates and returns a 4D.Blob that references data from a subset of the blob on which it's called. The original blob is not altered.

The start parameter is an index into the blob indicating the first byte to include in the new 4D.Blob. Se especificar um valor negativo, 4D trata-o como uma compensação desde o fim da bolha até ao início. Por exemplo, -10 seria o 10º do último byte na bolha. O valor predefinido é 0. If you specify a value for start that is larger than the size of the source blob, the returned 4D.Blob's size is 0, and it contains no data.

The end parameter is an index into the blob indicating the first byte that will not be included in the new 4D.Blob (i.e. the byte exactly at this index is not included). Se especificar um valor negativo, 4D trata-o como uma compensação desde o fim da bolha até ao início. Por exemplo, -10 seria o 10º do último byte na bolha. O valor por defeito é o tamanho do blob.

Exemplo

var $myBlob : 4D.Blob

// Store text in a 4D.Blob
CONVERT FROM TEXT("Hello, World!"; "UTF-8"; $myBlob)
$is4DBlob:=OB Instance of($myBlob; 4D.Blob); //True

$myString:=Convert to text($myBlob; "UTF-8")
// $myString contains "Hello, World!"

// Create a new 4D.Blob from $myBlob
$myNewBlob:=$myBlob.slice(0; 5)

$myString:=Convert to text($myNewBlob; "UTF-8")
// $myString contains "Hello"