## net.i2p.client.naming
Class BlockfileNamingService

    java.lang.Object
      net.i2p.client.naming.NamingService
          net.i2p.client.naming.DummyNamingService
              net.i2p.client.naming.BlockfileNamingService

    public class BlockfileNamingService

extends DummyNamingService

A naming service using the net.metanotion BlockFile database. This database contains the following skiplists:

     "%%__INFO__%%" is the master database skiplist, containing one entry:
         "info": a Properties, serialized with DataHelper functions:
                 "version": "1"
                 "created": Java long time (ms)
                 "lists":   Comma-separated list of host databases, to be
                            searched in-order for lookups

     For each host database, there is a skiplist containing
     the hosts for that database.
     The keys/values in these skiplists are as follows:
          key: a UTF-8 String
          value: a DestEntry, which is a Properties (serialized with DataHelper)
                 followed by a Destination (serialized as usual).

     The DestEntry Properties typically contains:
                 "a":   The time added (Java long time in ms)
                 "s":   The original source of the entry (typically a file name or subscription URL)
                 others TBD

All host names are converted to lower case.

Since:
  0.8.7

Field Summary

Fields inherited from class net.i2p.client.naming.DummyNamingService
`BASE32_HASH_LENGTH, CACHE_MAX_SIZE, DEST_SIZE, PROP_B32`

Fields inherited from class net.i2p.client.naming.NamingService
`_context, _listeners, _log, _updaters, PROP_IMPL`

Constructor Summary
`BlockfileNamingService(I2PAppContext context)`

Method Summary
`Map<String,Destination>` `getEntries(Properties options)`
`Destination` `lookup(String hostname, Properties lookupOptions, Properties storedOptions)` Same as lookup(hostname) but with in and out options Note that whether this (and lookup(hostname)) resolve B32 addresses is NamingService-specific.
`static void` `main(String[] args)`
`boolean` `put(String hostname, Destination d, Properties options)`
`boolean` `putIfAbsent(String hostname, Destination d, Properties options)` Fails if entry previously exists
`boolean` `remove(String hostname, Properties options)`
`void` `shutdown()` Parent will call when removed.
`int` `size(Properties options)`

Methods inherited from class net.i2p.client.naming.DummyNamingService
`clearCache, getCache, putCache, removeCache`

Methods inherited from class net.i2p.client.naming.NamingService

`addNamingService, addNamingService, createInstance, getBase64Entries, getConfiguration, getEntries, getName, getNames, getNames, getNamingServices, getParent, lookup, lookup, lookupBase32, lookupBase64, put, putAll, putIfAbsent, registerListener, registerUpdater, remove, removeNamingService, requestUpdate, reverseLookup, reverseLookup, reverseLookup, setConfiguration, size, start, toString, unregisterListener, unregisterUpdater, update`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### BlockfileNamingService

    public BlockfileNamingService(I2PAppContext context)

Throws:
  `RuntimeException` - on fatal error

Method Detail

### lookup

    public Destination lookup(String hostname,
                              Properties lookupOptions,
                              Properties storedOptions)

  Description copied from class: `NamingService`
  Same as lookup(hostname) but with in and out options Note that whether this (and lookup(hostname)) resolve B32 addresses is NamingService-specific.

  Overrides:
    `lookup` in class `DummyNamingService`
  Parameters:
    `hostname` - mixed case as it could be a key
    `lookupOptions` - input parameter, NamingService-specific, can be null
    `storedOptions` - output parameter, NamingService-specific, any stored properties will be added if non-null
  Returns:
    dest or null

### put

    public boolean put(String hostname,
                       Destination d,
                       Properties options)

  Overrides:
    `put` in class `NamingService`
  Parameters:
    `options` - If non-null and contains the key "list", add to that list (default "hosts.txt") Use the key "s" for the source
  Returns:
    success

### putIfAbsent

    public boolean putIfAbsent(String hostname,
                               Destination d,
                               Properties options)

  Description copied from class: `NamingService`
  Fails if entry previously exists

  Overrides:
    `putIfAbsent` in class `NamingService`
  Parameters:
    `options` - If non-null and contains the key "list", add to that list (default "hosts.txt") Use the key "s" for the source. Key "a" will be added with the current time, unless "a" is present in options.
  Returns:
    success

### remove

    public boolean remove(String hostname,
                          Properties options)

  Overrides:
    `remove` in class `NamingService`
  Parameters:
    `options` - If non-null and contains the key "list", remove from that list (default "hosts.txt", NOT all lists)
  Returns:
    success

### getEntries

    public Map<String,Destination> getEntries(Properties options)

  Overrides:
    `getEntries` in class `NamingService`
  Parameters:
    `options` - If non-null and contains the key "list", get from that list (default "hosts.txt", NOT all lists) Key "skip": skip that many entries Key "limit": max number to return Key "search": return only those matching substring Key "startsWith": return only those starting with ("[0-9]" allowed) Key "beginWith": start here in the iteration Don't use both startsWith and beginWith. Search, startsWith, and beginWith values must be lower case.
  Returns:
    all mappings (matching the options if non-null) or empty Map if none; Returned Map is not necessarily sorted, implementation dependent

### size

    public int size(Properties options)

  Overrides:
    `size` in class `NamingService`
  Parameters:
    `options` - If non-null and contains the key "list", return the size of that list (default "hosts.txt", NOT all lists)
  Returns:
    number of entries (matching the options if non-null) or -1 if unknown

### shutdown

    public void shutdown()

  Description copied from class: `NamingService`
  Parent will call when removed. If this is the root naming service, the core will stop it. Should not be called by others.

  Overrides:
    `shutdown` in class `NamingService`

### main

    public static void main(String[] args)