Adds a chunk to the stack

@param string $chunk The chunk to output
@param Less_FileInfo $fileInfo The file information
@param integer $index The index
@param mixed $mapLines
332887
public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){
		$this->strs[] = $chunk;
	}
299382
@Override
  public void writeChunk(long length, boolean isFinal)
  {
    long chunk;
    
    if (isFinal) {
      chunk = length << 1;
    }
    else {
      chunk = (length << 1) + 1;
    }
    
    writeUnsigned(chunk);
  }
131665
public function addInfo($info) : void
    {
        Assert::isInstanceOfAny($info, [Chunk::class, KeyInfo::class]);
        $this->info[] = $info;
    }
302651
public void write(final AbstractIndex index)
		throws IOException
	{

		StringBuilder cmd;

		while (index.size() > 0) {

			System.out.println("Transmit Index [" + index + "]");

			cmd = index.remove();
			// System.out.println(cmd.toString());

			cmd.append("\r\n");
			writer.write(cmd.toString());
		}

		writer.flush();
	}
1213962
protected function emit(string $chunk): void
    {
        echo $chunk;

        $this->flush(Closure::fromCallable('ob_flush'));
        $this->flush(Closure::fromCallable('flush'));
    }
336953
protected function insert_chunk($table, array $chunk, array $columns) {
        $fieldssql = '('.implode(',', array_keys($columns)).')';

        $valuessql = '('.implode(',', array_fill(0, count($columns), '?')).')';
        $valuessql = implode(',', array_fill(0, count($chunk), $valuessql));

        $params = array();
        foreach ($chunk as $dataobject) {
            foreach ($columns as $field => $column) {
                $params[] = $this->normalise_value($column, $dataobject[$field]);
            }
        }

        $sql = "INSERT INTO {$this->prefix}$table $fieldssql VALUES $valuessql";

        list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
        $rawsql = $this->emulate_bound_params($sql, $params);

        $this->query_start($sql, $params, SQL_QUERY_INSERT);
        $result = $this->mysqli->query($rawsql);
        $this->query_end($result);
    }
635893
public function addFile($file, $fileInfo)
    {
        if (!($fileInfo instanceof \SplFileInfo)) {
            $fileInfo = new \SplFileInfo($fileInfo);
        }

        $this->files[$file] = $fileInfo;

        try {
            $mTime = $fileInfo->getMTime();
        } catch (\Exception $e) {
            $mTime = 0;
        }

        if ($mTime > $this->maxMTime) {
            $this->maxMTime = $mTime;
        }

        return $this;
    }
327700
public void addBin(List<Chunk> chunksToAdd, long lastLocus) {
    assert chunks != null;
    contig = new Contig(contig.referenceName, contig.start, lastLocus);
    chunks.addAll(chunksToAdd);
    updateSpan();
  }
249581
public function addNestedVerb($index, $verb) {
      if (!($index <= sizeof($this->verbs))) {
        throw new \CatapultApiException("This verb does not have $index nested verbs");
      }
      
      $this->verbs[$index]->addVerb($verb);
    }
1339919
public void pushNestedPath(final String subPath, final int index) {
        final String canonicalPath = normalizePath(subPath);
        ArgUtils.notEmpty(subPath, "subPath");
        ArgUtils.notMin(index, -1, "index");
        
        pushNestedPath(String.format("%s[%d]", canonicalPath, index));
    }
54165
public function addIndex($type, $index)
    {
        if (!isset($this->indexes[$type])) {
            $this->indexes[$type] = [];
        }

        $this->indexes[$type][] = $index;
    }
270429
protected function populateIndex($index)
    {
        $this->line('Populating the index « '.$index.' » ...');

        // Replaces the current default index by the one we want to populate
        $defaultIndex = Plastic::getDefaultIndex();
        Plastic::setDefaultIndex($index);

        // Disables query logging to prevent memory leak
        $logging = DB::connection()->logging();
        DB::connection()->disableQueryLog();

        // Populates from models
        $models = $this->models($index);
        $chunkSize = $this->chunkSize();
        foreach ($models as $model) {
            $this->line('Indexing documents of model « '.$model.' » ...');
            $model::chunk($chunkSize, function ($items) {
                $this->line('Indexing chunk of '.$items->count().' documents ...');
                Plastic::persist()->bulkSave($items);
            });
        }

        // Restores query logging
        if ($logging) {
            DB::connection()->enableQueryLog();
        }

        // Restores the current default index
        Plastic::setDefaultIndex($defaultIndex);
    }
1303466
public static function write_chunk($chunk, $chunks, $path, $file, $fsencoding = '') {
        $dest = WEB_ROOT . $path;
        $dest = self::conv_to($dest, $fsencoding);
        $cfg_path = $dest . '.ucfg';

        if (!file_exists($dest) || !file_exists($cfg_path)) {
            throw new Exception('文件不存在');
        }

        $tmp_name = $file['tmp_name'];
        $content = file_get_contents($tmp_name);
        $size = strlen($content);
        unlink($tmp_name);

        $dh = fopen($dest, 'r+');
        if ($chunk == $chunks - 1) {
            fseek($dh, -1 * $size, SEEK_END);
        }
        else {
            fseek($dh, $size * $chunk, SEEK_SET);
        }
        fwrite($dh, $content, $size);
        fclose($dh);

        $cfg = file($cfg_path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
        if ($cfg == null || $cfg == '') {
            $cfg = [
                $chunks, 0, str_repeat('0', $chunks)
            ];
        }
        $cfg[2][$chunk] = '1';
        $cfg[1] = strpos($cfg[2], '0', $cfg[1]);
        if ($cfg[1] === false) {
            $cfg[1] = $chunks;
        }
        file_put_contents($cfg_path, implode("\n", $cfg));
    }
805792
public function init($chunk = null) {
        if (is_null($chunk) && is_null($chunk = $this->_getCurrentStateFromRequest())) {
            $chunk = 1;
        }
        if ($chunk < 1) {
            $chunk = 1;
        }
        $this->_chunk   = $chunk;
        $this->_results = $this->_fetchContent($chunk);
        $this->_max = $this->_fetchMaxChunks();
        return $this;
    }
147480
public void put(byte[] source, int index, int length)
    {
        // If the buffer is small.
        if (mBuffer.capacity() < (mLength + length))
        {
            expandBuffer(mLength + length + ADDITIONAL_BUFFER_SIZE);
        }

        mBuffer.put(source, index, length);
        mLength += length;
    }
827126
def _send_chunk(self, chunk, chunk_num):
        
        url_info = self.upload_operations.create_file_chunk_url(self.upload_id, chunk_num, chunk)
        self.upload_operations.send_file_external(url_info, chunk)
547970
public function appendFile($source, $index = 0)
    {
        $chunkFile = $this->chunkFile().'.'.$index;
        $this->files->appendStream($chunkFile, $source, 0);

        return $this;
    }