Ensures bytes in the buffer with a specific length and location in the file.

@param int $pos
@param int $length
@see reset()
343019
public function ensure($pos, $length)
    {
        if ($pos >= $this->position
            && $pos < ($this->position + $this->bufferLength)
            && ($this->position + $this->bufferLength) >= ($pos + $length)
        ) {
            $this->offset = $pos - $this->position;
        } else {
            $this->reset($pos, $length);
        }
    }
1221667
public void setLength(int length) {
		if (length < 0 || body.length == length) {
			return;
		}

		int oldPos = pos;
		pos = Math.min(pos, length);

		byte[] newBody = new byte[length];
		System.arraycopy(body, 0, newBody, 0, pos);
		body = newBody;
		
		if (oldPos > pos) {
			cachedString = null;
		}
	}
738608
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setUserId($value);
                break;
            case 1:
                $this->setRoleId($value);
                break;
        } // switch()
    }
237651
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setVisible($value);
                break;
            case 2:
                $this->setAddress1($value);
                break;
            case 3:
                $this->setAddress2($value);
                break;
            case 4:
                $this->setAddress3($value);
                break;
            case 5:
                $this->setZipcode($value);
                break;
            case 6:
                $this->setCity($value);
                break;
            case 7:
                $this->setCountryId($value);
                break;
            case 8:
                $this->setLatitude($value);
                break;
            case 9:
                $this->setLongitude($value);
                break;
            case 10:
                $this->setCreatedAt($value);
                break;
            case 11:
                $this->setUpdatedAt($value);
                break;
            case 12:
                $this->setVersion($value);
                break;
            case 13:
                $this->setVersionCreatedAt($value);
                break;
            case 14:
                $this->setVersionCreatedBy($value);
                break;
            case 15:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerShedulesIds($value);
                break;
            case 16:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerShedulesVersions($value);
                break;
            case 17:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerContactIds($value);
                break;
            case 18:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerContactVersions($value);
                break;
            case 19:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerContentIds($value);
                break;
            case 20:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerContentVersions($value);
                break;
            case 21:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerFolderIds($value);
                break;
            case 22:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerFolderVersions($value);
                break;
            case 23:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerBrandIds($value);
                break;
            case 24:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerBrandVersions($value);
                break;
            case 25:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerProductIds($value);
                break;
            case 26:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerProductVersions($value);
                break;
            case 27:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerAdminIds($value);
                break;
            case 28:
                if (!is_array($value)) {
                    $v = trim(substr($value, 2, -2));
                    $value = $v ? explode(' | ', $v) : array();
                }
                $this->setDealerAdminVersions($value);
                break;
        } // switch()
    }
78074
public function overwrite($pos, $len)
	{
		if ($len > 0)
		{
			$this->text = substr($this->text, 0, $pos) . str_repeat("\x1A", $len) . substr($this->text, $pos + $len);
		}
	}
1198660
public void writeTo(final PacketOutputStream pos) throws IOException {
    pos.write(BINARY_INTRODUCER);
    if (length == Long.MAX_VALUE) {
      pos.write(is, true, noBackslashEscapes);
    } else {
      pos.write(is, length, true, noBackslashEscapes);
    }
    pos.write(QUOTE);

  }
904687
public function read($length)
    {
        $pos = $this->stream->tell();
        $ret = $this->seekAndRead($length);
        $this->position += strlen($ret);
        $this->stream->seek($pos);
        if ($this->limit !== -1 && $this->position > $this->limit) {
            $ret = substr($ret, 0, -($this->position - $this->limit));
            $this->position = $this->limit;
        }
        return $ret;
    }
1011578
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setType($value);
                break;
            case 2:
                $this->setName($value);
                break;
            case 3:
                $this->setDomain($value);
                break;
            case 4:
                $this->setApiUrl($value);
                break;
            case 5:
                $this->setApiAuthHttpUser($value);
                break;
            case 6:
                $this->setApiAuthHttpPassword($value);
                break;
            case 7:
                $this->setApiAuthType($value);
                break;
            case 8:
                $this->setApiAuthUser($value);
                break;
            case 9:
                $this->setApiAuthPassword($value);
                break;
            case 10:
                $this->setApiAuthToken($value);
                break;
            case 11:
                $this->setApiAuthUrlUserKey($value);
                break;
            case 12:
                $this->setApiAuthUrlPwKey($value);
                break;
            case 13:
                $this->setCron($value);
                break;
            case 14:
                $this->setCustomerId($value);
                break;
            case 15:
                $this->setActivated($value);
                break;
            case 16:
                $this->setNotes($value);
                break;
            case 17:
                $this->setLastRun($value);
                break;
            case 18:
                $this->setIncludelog($value);
                break;
            case 19:
                $this->setPublicKey($value);
                break;
            case 20:
                $this->setWebsiteHash($value);
                break;
            case 21:
                $this->setNotificationRecipient($value);
                break;
            case 22:
                $this->setNotificationSender($value);
                break;
            case 23:
                $this->setNotificationChange($value);
                break;
            case 24:
                $this->setNotificationError($value);
                break;
        } // switch()
    }
212688
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setAttributeAvId($value);
                break;
            case 2:
                $this->setAttributeAttributeTypeId($value);
                break;
            case 3:
                $this->setLocale($value);
                break;
            case 4:
                $this->setValue($value);
                break;
            case 5:
                $this->setCreatedAt($value);
                break;
            case 6:
                $this->setUpdatedAt($value);
                break;
        } // switch()
    }
993694
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setUsername($value);
                break;
            case 2:
                $this->setPassword($value);
                break;
            case 3:
                $this->setSalt($value);
                break;
            case 4:
                $this->setFirstname($value);
                break;
            case 5:
                $this->setLastname($value);
                break;
            case 6:
                $this->setEmail($value);
                break;
            case 7:
                $this->setPhone($value);
                break;
            case 8:
                $this->setMemo($value);
                break;
            case 9:
                $this->setActivated($value);
                break;
            case 10:
                $this->setLastLogin($value);
                break;
            case 11:
                $this->setNotificationChange($value);
                break;
            case 12:
                $this->setNotificationError($value);
                break;
        } // switch()
    }
1037453
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setSourceId($value);
                break;
            case 2:
                $this->setPageid($value);
                break;
            case 3:
                $this->setTitle($value);
                break;
            case 4:
                $this->setDisplaytitle($value);
                break;
            case 5:
                $this->setPageImageFree($value);
                break;
            case 6:
                $this->setWikibaseItem($value);
                break;
            case 7:
                $this->setDisambiguation($value);
                break;
            case 8:
                $this->setDefaultsort($value);
                break;
            case 9:
                $this->setCreatedAt($value);
                break;
            case 10:
                $this->setUpdatedAt($value);
                break;
        } // switch()

        return $this;
    }
198179
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setName($value);
                break;
            case 2:
                $this->setStreet($value);
                break;
            case 3:
                $this->setZip($value);
                break;
            case 4:
                $this->setCity($value);
                break;
            case 5:
                $this->setCountryId($value);
                break;
            case 6:
                $this->setPhone($value);
                break;
            case 7:
                $this->setFax($value);
                break;
            case 8:
                $this->setEmail($value);
                break;
            case 9:
                $this->setLegalform($value);
                break;
            case 10:
                $this->setLogo($value);
                break;
            case 11:
                $this->setCreated($value);
                break;
            case 12:
                $this->setNotes($value);
                break;
        } // switch()
    }
83362
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setSportId($value);
                break;
            case 2:
                $this->setName($value);
                break;
            case 3:
                $this->setAlternativeName($value);
                break;
            case 4:
                $this->setSlug($value);
                break;
            case 5:
                $this->setDescription($value);
                break;
            case 6:
                $this->setHistory($value);
                break;
            case 7:
                $this->setIsTranslation($value);
                break;
            case 8:
                $this->setIsRotation($value);
                break;
            case 9:
                $this->setIsAcyclic($value);
                break;
            case 10:
                $this->setIsCyclic($value);
                break;
            case 11:
                $this->setLongitudinalFlags($value);
                break;
            case 12:
                $this->setLatitudinalFlags($value);
                break;
            case 13:
                $this->setTransversalFlags($value);
                break;
            case 14:
                $this->setMovementDescription($value);
                break;
            case 15:
                $this->setSequencePictureUrl($value);
                break;
            case 16:
                $this->setVariationOfId($value);
                break;
            case 17:
                $this->setStartPositionId($value);
                break;
            case 18:
                $this->setEndPositionId($value);
                break;
            case 19:
                $this->setIsComposite($value);
                break;
            case 20:
                $this->setIsMultiple($value);
                break;
            case 21:
                $this->setMultipleOfId($value);
                break;
            case 22:
                $this->setMultiplier($value);
                break;
            case 23:
                $this->setGeneration($value);
                break;
            case 24:
                $this->setImportance($value);
                break;
            case 25:
                $this->setPictureId($value);
                break;
            case 26:
                $this->setVideoId($value);
                break;
            case 27:
                $this->setTutorialId($value);
                break;
            case 28:
                $this->setKstrukturId($value);
                break;
            case 29:
                $this->setFunctionPhaseId($value);
                break;
            case 30:
                $this->setObjectId($value);
                break;
            case 31:
                $this->setVersion($value);
                break;
            case 32:
                $this->setVersionCreatedAt($value);
                break;
            case 33:
                $this->setVersionComment($value);
                break;
        } // switch()

        return $this;
    }
510858
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setPersonId($value);
                break;
            case 2:
                $this->setFunctionId($value);
                break;
            case 3:
                $this->setCreatedAt($value);
                break;
            case 4:
                $this->setUpdatedAt($value);
                break;
            case 5:
                $this->setVersion($value);
                break;
            case 6:
                $this->setVersionCreatedAt($value);
                break;
            case 7:
                $this->setVersionCreatedBy($value);
                break;
            case 8:
                $this->setPersonIdVersion($value);
                break;
            case 9:
                $this->setFunctionIdVersion($value);
                break;
        } // switch()
    }
895770
private function setLength($length)
    {
        try {
            $this->length = (float)$length;
            unset($length);
            return 0;
        } catch (\Exception $e) {
            throw $e;
        }
    }
438693
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setFeatureId($value);
                break;
            case 2:
                $this->setFeatureTypeId($value);
                break;
        } // switch()
    }
409929
public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setSkillId($value);
                break;
            case 2:
                $this->setAncestorId($value);
                break;
            case 3:
                $this->setPosition($value);
                break;
        } // switch()

        return $this;
    }