Inserts file chunk.
@param string $data chunk binary content.
3786
private function insertChunk($data)
    {
        $chunkDocument = [
            'files_id' => $this->_documentId,
            'n' => $this->chunkCount,
            'data' => new Binary($data, Binary::TYPE_GENERIC),
        ];

        hash_update($this->_hashContext, $data);

        $this->collection->getChunkCollection()->insert($chunkDocument);
        $this->length += StringHelper::byteLength($data);
        $this->chunkCount++;
    }
1101996
public function insert(array $data) {
        $this->notifyObservers('beforeInsert', array($this, &$data));
        $pkData = parent::insert($data);
        $this->notifyObservers('afterInsert', array($this, $data, $pkData));
        return $pkData;
    }
792580
function append($data)
    {
        if ($this->_PPS_FILE) {
            fwrite($this->_PPS_FILE, $data);
        } else {
            $this->_data .= $data;
        }
    }
1346732
public static function insert($data)
    {
        $self  = self::getInstance();
        $table = $self->table_name;

        if (isset($data[0])) {
            $make      = $self->makeMultipleInsert($table, $data);
            $statement = $make[0];
            $value     = $make[1];
        } else {
            $newData    = $self->makeInsertParameter($data);
            $column     = implode(",", array_keys($data));
            $paramValue = implode(",", array_keys($newData));
            $statement  = "INSERT INTO {$table} ({$column}) VALUES({$paramValue});";
            $value      = $newData;
        }

        $execute   = $self->exec($statement, $value);

        return $execute;
    }
1266226
private function insertChunksFromBytes($bytes, $record)
    {
        $chunkSize = $record['chunkSize'];
        $fileId = $record['_id'];
        $i = 0;

        $chunks = str_split($bytes, $chunkSize);
        foreach ($chunks as $chunk) {
            $this->insertChunk($fileId, $chunk, $i++);
        }
    }
1258690
public function insert($data)
    {
        DB::transaction(function() use($data) {
            $data['code'] = strtolower($data['code']);
            $model        = new Languages($data);
            $model->save();
            $inserts      = $this->prepareMultiInsert($data['code']);
            DB::table('tbl_translations')->insert($inserts);
        });
    }
1260971
public function addStreamData($data) {
        if ($this->isFinalized || strlen($this->streamFilePath) == 0) {
            return FALSE;
        }

        $length = fwrite($this->streamData, $data, strlen($data));
        if ($length != strlen($data)) {
            throw new Exception("File IO: Error writing; Length mismatch: Expected " . strlen($data) . " bytes, wrote " . ($length === FALSE ? "NONE!" : $length));
        }
        $this->streamFileLength += $length;

        return $length;
    }
279000
public function addLiteralStream($data)
    {
        $pos = $this->_stream->pos();
        if (!isset($this->_literals[$pos])) {
            $this->_literals[$pos] = new Horde_Stream_Temp();
        }
        $this->_literals[$pos]->add($data);
    }
659979
public function add( $data )
	{
		$enclosure = $this->_enclosure;

		foreach( (array) $data as $key => $entry )
		{
			$entry = str_replace( $this->_lineend, $this->_endsubst, $entry );
			$data[$key] = $enclosure . str_replace( $enclosure, $this->_escape . $enclosure, $entry ) . $enclosure;
		}

		if( fwrite( $this->_fh, implode( $this->_separator, $data ) . $this->_lineend ) === false ) {
			throw new MW_Container_Exception( sprintf( 'Unable to add content to file "%1$s"', $this->getName() ) );
		}
	}
381467
protected function write(string $data):void{
		$len = \strlen($data);

		for($i = 0; $i + 1 < $len; $i += 2){
			$c = ((0xff & \ord($data[$i])) << 8) | (0xff & \ord($data[$i + 1]));

			if(0x8140 <= $c && $c <= 0x9FFC){
				$c -= 0x8140;
			}
			elseif(0xE040 <= $c && $c <= 0xEBBF){
				$c -= 0xC140;
			}
			else{
				throw new QRCodeDataException('illegal char at '.($i + 1).' ['.$c.']');
			}

			$this->bitBuffer->put((($c >> 8) & 0xff) * 0xC0 + ($c & 0xff), 13);

		}

		if($i < $len){
			throw new QRCodeDataException('illegal char at '.($i + 1));
		}

	}
1032461
protected function postprocess_chunk($data) {

        // Iterate over all the data tags, if any of them is
        // not 'subplugin_XXXX' or has value, then it's a valid chunk,
        // pass it to standard (parent) processing of chunks.
        foreach ($data['tags'] as $key => $value) {
            if (trim($value) !== '' || strpos($key, 'subplugin_') !== 0) {
                parent::postprocess_chunk($data);
                return;
            }
        }
        // Arrived here, all the tags correspond to sublplugins and are empty,
        // skip the chunk, and debug_developer notice
        $this->chunks--; // not counted
        debugging('Missing support on restore for ' . clean_param($data['path'], PARAM_PATH) .
                  ' subplugin (' . implode(', ', array_keys($data['tags'])) .')', DEBUG_DEVELOPER);
    }
70315
public function put($key, $data)
    {
        $filename = $this->getKeyCode($key);
        $data = json_encode($data);
        $this->write($data, $filename);
    }
150797
protected function insert(Data $data)
    {
        $this->__before('insert', $data);
        $data->validate();

        if (!is_array($id = $this->doInsert($data))) {
            return false;
        }

        $this->pack($id, $data);
        $this->__after('insert', $data);

        return true;
    }
1114525
public function writeData($data)
	{
		if (strlen($data) - 4 > $this->_limit) {
			$data = $this->_addContinue($data);
		}
		$this->_datasize += strlen($data);

		return $data;
	}
1127147
public function insertNewRecord($data) {

        $emailAttachment = new Email_attachment;

        $emailAttachment->email_messages_id          = $data['email_messages_id'];
        $emailAttachment->attachment_path            = $data['attachment_path'];
        $emailAttachment->attachment_filename        = $data['attachment_filename'];
        $emailAttachment->alternate_sort_string1     = $data['alternate_sort_string1'];
        $emailAttachment->alternate_sort_string2     = $data['alternate_sort_string2'];
        $emailAttachment->comments                   = $data['comments'];

        return $emailAttachment->save();
    }
1369318
public function writeBytes($data)
    {
        if ($this->isClosed) {
            // TODO: Should this be an error condition? e.g. BadMethodCallException
            return;
        }

        $bytesRead = 0;

        while ($bytesRead != strlen($data)) {
            $initialBufferLength = strlen($this->buffer);
            $this->buffer .= substr($data, $bytesRead, $this->chunkSize - $initialBufferLength);
            $bytesRead += strlen($this->buffer) - $initialBufferLength;

            if (strlen($this->buffer) == $this->chunkSize) {
                $this->insertChunkFromBuffer();
            }
        }

        return $bytesRead;
    }
517315
protected function send($data)
    {
        $pos = $this->tell();

        // Add data to the end of the buffer.
        $this->seek(0, SEEK_END);
        $this->write($data);
        if ($pos !== false) {
            // Rewind so that read() can later read this data.
            $this->seek($pos);
        }
    }