Class IPResult
java.lang.Object
co.mindus.ip2location.IPResult
Low-level result object from IP2Location BIN database queries.
This class holds the complete set of fields that can be returned from an IP2Location database lookup. The availability of each field depends on the database type being used.
For high-level usage, prefer GeoLocation which is returned by IP2LocationService.lookup(String). This class is primarily used internally by the BIN file reader.
Status Values
| Status | Meaning |
|---|---|
| OK | Query successful |
| EMPTY_IP_ADDRESS | IP address was null or empty |
| INVALID_IP_ADDRESS | IP address format was invalid |
| IP_ADDRESS_NOT_FOUND | IP not found in database |
| MISSING_FILE | Database file not loaded |
| IPV6_NOT_SUPPORTED | Database doesn't support IPv6 |
| DATABASE_ERROR | I/O error during query |
Field Availability
| Field | LITE Databases | Commercial |
|---|---|---|
| Country (short/long) | All | All |
| Region, City | DB3+ | DB3+ |
| Latitude, Longitude | DB5+ | DB5+ |
| ZIP Code | DB9+ | DB9+ |
| Timezone | DB11+ | DB11+ |
| ISP, Domain | - | Commercial only |
| ASN, AS | - | Commercial only |
Thread Safety
This class is mutable and not thread-safe. Each query produces a new instance.
- Author:
- Christopher Mindus
- See Also:
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this result with another for equality.Returns the address type.Returns the area code.getAS()Returns the Autonomous System name.Returns the Autonomous System CIDR.Returns the Autonomous System domain name.getASN()Returns the Autonomous System Number.Returns the Autonomous System usage type.Returns the IAB category.getCity()Returns the city name.Returns the full country name.Returns the ISO 3166-1 alpha-2 country code.Returns the district name.Returns the domain name.Returns the elevation.Returns the IDD code.Returns the queried IP address.getISP()Returns the ISP name.Returns the latitude.Returns the longitude.getMCC()Returns the Mobile Country Code.getMNC()Returns the Mobile Network Code.Returns the mobile carrier brand name.Returns the network speed category.Returns the region or state name.Returns the query status.Returns the timezone.Returns the usage type.Returns the weather station code.Returns the weather station name.Returns the ZIP or postal code.inthashCode()Returns a hash code for this result.toString()Returns a string representation of this result.
Method Details
getIpAddress
Returns the queried IP address.- Returns:
- The IP address string that was queried
getStatus
Returns the query status.- Returns:
- Status string (e.g., "OK", "INVALID_IP_ADDRESS")
getCountryShort
Returns the ISO 3166-1 alpha-2 country code.- Returns:
- Two-letter country code (e.g., "US"), or "-" if unavailable
getCountryLong
Returns the full country name.- Returns:
- Country name (e.g., "United States of America"), or "-" if unavailable
getRegion
Returns the region or state name.- Returns:
- Region name (e.g., "California"), or "-" if unavailable
getCity
Returns the city name.- Returns:
- City name (e.g., "Mountain View"), or "-" if unavailable
getLatitude
Returns the latitude.- Returns:
- Latitude in decimal degrees, or 0.0 if unavailable
getLongitude
Returns the longitude.- Returns:
- Longitude in decimal degrees, or 0.0 if unavailable
getZipCode
Returns the ZIP or postal code.- Returns:
- ZIP/postal code string, or "-" if unavailable
getTimeZone
Returns the timezone.- Returns:
- Timezone in tz database format, or "-" if unavailable
getISP
Returns the ISP name.- Returns:
- Internet Service Provider name, or "-" if unavailable
getDomain
getNetSpeed
Returns the network speed category.- Returns:
- Speed category (e.g., "DSL", "COMP"), or "-" if unavailable
getIDDCode
Returns the IDD code.- Returns:
- International Direct Dialing code, or "-" if unavailable
getAreaCode
getMCC
getMNC
getMobileBrand
Returns the mobile carrier brand name.- Returns:
- Mobile brand name, or "-" if unavailable
getWeatherStationCode
Returns the weather station code.- Returns:
- Weather station code, or "-" if unavailable
getWeatherStationName
Returns the weather station name.- Returns:
- Weather station name, or "-" if unavailable
getElevation
Returns the elevation.- Returns:
- Elevation in meters, or "-" if unavailable
getUsageType
Returns the usage type.- Returns:
- Usage type (e.g., "ISP", "CDN", "DCH"), or "-" if unavailable
getAddressType
Returns the address type.- Returns:
- Address type (e.g., "Anycast", "Unicast"), or "-" if unavailable
getCategory
getDistrict
getASN
getAS
getASDomain
Returns the Autonomous System domain name.- Returns:
- AS domain, or "-" if unavailable
getASUsageType
Returns the Autonomous System usage type.- Returns:
- AS usage type, or "-" if unavailable
getASCIDR
toString
hashCode
equals