/** * Returns the country the IP address is in. * * @param addr * the IP address as Inet6Address. * @return the country the IP address is from. */ public synchronized Country getCountryV6(InetAddress addr) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountryV6(addr) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
public synchronized Location getLocationV6(InetAddress addr) { int seek_country; try { seek_country = seekCountryV6(addr); return readCityRecord(seek_country); } catch (IOException e) { throw new InvalidDatabaseException("Error while seting up segments", e); } }
public synchronized String getOrgV6(InetAddress addr) { try { int seekOrg = seekCountryV6(addr); return readOrgRecord(seekOrg); } catch (IOException e) { throw new InvalidDatabaseException("Error while reading org", e); } }
/** * Returns the country the IP address is in. * * @param addr the IP address as Inet6Address. * @return the country the IP address is from. */ public Country getCountryV6(InetAddress addr) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountryV6(addr) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
/** * Returns the country the IP address is in. * * @param addr * the IP address as Inet6Address. * @return the country the IP address is from. */ public synchronized Country getCountryV6(InetAddress addr) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountryV6(addr) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
/** * Returns the country the IP address is in. * * @param addr * the IP address as Inet6Address. * @return the country the IP address is from. */ public synchronized Country getCountryV6(InetAddress addr) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountryV6(addr) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
/** * Returns the country the IP address is in. * * @param addr the IP address as Inet6Address. * @return the country the IP address is from. */ public Country getCountryV6(InetAddress addr) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountryV6(addr) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
/** * Returns the country the IP address is in. * * @param addr the IP address as Inet6Address. * @return the country the IP address is from. */ public Country getCountryV6(InetAddress addr) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountryV6(addr) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
seek_org = seekCountryV6(addr); if (seek_org == databaseSegments[0]) { return null;
seek_org = seekCountryV6(addr); if (seek_org == databaseSegments[0]) { return null;
public synchronized String getOrgV6(InetAddress addr) { int seek_org; int record_pointer; int str_length = 0; byte[] buf = new byte[MAX_ORG_RECORD_LENGTH]; String org_buf; try { seek_org = seekCountryV6(addr); if (seek_org == databaseSegments[0]) { return null; } record_pointer = seek_org + (2 * recordLength - 1) * databaseSegments[0]; if ((dboptions & GEOIP_MEMORY_CACHE) == 1) { //read from memory System.arraycopy(dbbuffer, record_pointer, buf, 0, Math.min(dbbuffer.length - record_pointer, MAX_ORG_RECORD_LENGTH)); } else { //read from disk file.seek(record_pointer); file.readFully(buf); } while (buf[str_length] != '\0') { str_length++; } org_buf = new String(buf, 0, str_length, "ISO-8859-1"); return org_buf; } catch (IOException e) { System.out.println("IO Exception"); return null; } }
public synchronized Location getLocationV6(InetAddress addr) { int seek_country; try { seek_country = seekCountryV6(addr); return readCityRecord(seek_country); } catch (IOException e) { throw new InvalidDatabaseException("Error while seting up segments", e); } }
public synchronized Location getLocationV6(InetAddress addr) { int seekCountry; try { seekCountry = seekCountryV6(addr); return readCityRecord(seekCountry); } catch (IOException e) { throw new InvalidDatabaseException("Error while seting up segments", e); } }
public synchronized String getOrgV6(InetAddress addr) { try { int seekOrg = seekCountryV6(addr); return readOrgRecord(seekOrg); } catch (IOException e) { throw new InvalidDatabaseException("Error while reading org", e); } }
public synchronized String getOrgV6(InetAddress addr) { try { int seekOrg = seekCountryV6(addr); return readOrgRecord(seekOrg); } catch (IOException e) { throw new InvalidDatabaseException("Error while reading org", e); } }
seek_country = seekCountryV6(addr); if (seek_country == databaseSegments[0]) { return null;
seek_country = seekCountryV6(addr); if (seek_country == databaseSegments[0]) { return null;
seek_country = seekCountryV6(addr); if (seek_country == databaseSegments[0]) { return null;