Overview

Namespaces

  • GeoIp2
    • Database
    • Exception
    • Model
    • Record
    • WebService
  • MaxMind
    • Db
      • Reader
  • PHP

Classes

  • GeoIp2\Database\Reader
  • GeoIp2\Model\AnonymousIp
  • GeoIp2\Model\Asn
  • GeoIp2\Model\City
  • GeoIp2\Model\ConnectionType
  • GeoIp2\Model\Country
  • GeoIp2\Model\Domain
  • GeoIp2\Model\Enterprise
  • GeoIp2\Model\Insights
  • GeoIp2\Model\Isp
  • GeoIp2\Record\AbstractPlaceRecord
  • GeoIp2\Record\AbstractRecord
  • GeoIp2\Record\City
  • GeoIp2\Record\Continent
  • GeoIp2\Record\Country
  • GeoIp2\Record\Location
  • GeoIp2\Record\MaxMind
  • GeoIp2\Record\Postal
  • GeoIp2\Record\RepresentedCountry
  • GeoIp2\Record\Subdivision
  • GeoIp2\Record\Traits
  • GeoIp2\WebService\Client
  • MaxMind\Db\Reader
  • MaxMind\Db\Reader\Decoder
  • MaxMind\Db\Reader\Metadata
  • MaxMind\Db\Reader\Util

Interfaces

  • GeoIp2\ProviderInterface
  • JsonSerializable
  • Throwable

Exceptions

  • BadFunctionCallException
  • BadMethodCallException
  • Exception
  • GeoIp2\Exception\AddressNotFoundException
  • GeoIp2\Exception\AuthenticationException
  • GeoIp2\Exception\GeoIp2Exception
  • GeoIp2\Exception\HttpException
  • GeoIp2\Exception\InvalidRequestException
  • GeoIp2\Exception\OutOfQueriesException
  • InvalidArgumentException
  • LogicException
  • MaxMind\Db\Reader\InvalidDatabaseException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace MaxMind\Db\Reader;
 4: 
 5: class Util
 6: {
 7:     public static function read($stream, $offset, $numberOfBytes)
 8:     {
 9:         if ($numberOfBytes === 0) {
10:             return '';
11:         }
12:         if (fseek($stream, $offset) === 0) {
13:             $value = fread($stream, $numberOfBytes);
14: 
15:             // We check that the number of bytes read is equal to the number
16:             // asked for. We use ftell as getting the length of $value is
17:             // much slower.
18:             if (ftell($stream) - $offset === $numberOfBytes) {
19:                 return $value;
20:             }
21:         }
22:         throw new InvalidDatabaseException(
23:             'The MaxMind DB file contains bad data'
24:         );
25:     }
26: }
27: 
GeoIP2 PHP API v2.9.0 API documentation generated by ApiGen