javadoc
This commit is contained in:
@ -109,6 +109,8 @@ public class DataHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Writes the props to the stream, sorted by property name.
|
||||||
|
*
|
||||||
* jrandom disabled UTF-8 in mid-2004, for performance reasons,
|
* jrandom disabled UTF-8 in mid-2004, for performance reasons,
|
||||||
* i.e. slow foo.getBytes("UTF-8")
|
* i.e. slow foo.getBytes("UTF-8")
|
||||||
* Re-enable it so we can pass UTF-8 tunnel names through the I2CP SessionConfig.
|
* Re-enable it so we can pass UTF-8 tunnel names through the I2CP SessionConfig.
|
||||||
@ -145,6 +147,11 @@ public class DataHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reads the props from the byte array
|
||||||
|
* @param props returned OrderedProperties (sorted by property name)
|
||||||
|
* @return new offset
|
||||||
|
*/
|
||||||
public static int toProperties(byte target[], int offset, Properties props) throws DataFormatException, IOException {
|
public static int toProperties(byte target[], int offset, Properties props) throws DataFormatException, IOException {
|
||||||
if (props != null) {
|
if (props != null) {
|
||||||
OrderedProperties p = new OrderedProperties();
|
OrderedProperties p = new OrderedProperties();
|
||||||
@ -174,6 +181,11 @@ public class DataHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the props to the byte array, not sorted
|
||||||
|
* (unless the target param is an OrderedProperties)
|
||||||
|
* @return new offset
|
||||||
|
*/
|
||||||
public static int fromProperties(byte source[], int offset, Properties target) throws DataFormatException, IOException {
|
public static int fromProperties(byte source[], int offset, Properties target) throws DataFormatException, IOException {
|
||||||
int size = (int)fromLong(source, offset, 2);
|
int size = (int)fromLong(source, offset, 2);
|
||||||
offset += 2;
|
offset += 2;
|
||||||
@ -196,6 +208,10 @@ public class DataHelper {
|
|||||||
return offset + size;
|
return offset + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the props to returned byte array, not sorted
|
||||||
|
* (unless the opts param is an OrderedProperties)
|
||||||
|
*/
|
||||||
public static byte[] toProperties(Properties opts) {
|
public static byte[] toProperties(Properties opts) {
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(2);
|
ByteArrayOutputStream baos = new ByteArrayOutputStream(2);
|
||||||
@ -209,8 +225,8 @@ public class DataHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pretty print the mapping
|
* Pretty print the mapping, unsorted
|
||||||
*
|
* (unless the options param is an OrderedProperties)
|
||||||
*/
|
*/
|
||||||
public static String toString(Properties options) {
|
public static String toString(Properties options) {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
@ -278,6 +294,7 @@ public class DataHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Writes the props to the file, unsorted.
|
||||||
* Note that this does not escape the \r or \n that are unescaped in loadProps() above.
|
* Note that this does not escape the \r or \n that are unescaped in loadProps() above.
|
||||||
*/
|
*/
|
||||||
public static void storeProps(Properties props, File file) throws IOException {
|
public static void storeProps(Properties props, File file) throws IOException {
|
||||||
|
@ -25,6 +25,8 @@ import net.i2p.util.Log;
|
|||||||
*
|
*
|
||||||
* NOTE: Unused directly - see FloodOnlySearchJob extension which overrides almost everything.
|
* NOTE: Unused directly - see FloodOnlySearchJob extension which overrides almost everything.
|
||||||
* TODO: Comment out or delete what we don't use here.
|
* TODO: Comment out or delete what we don't use here.
|
||||||
|
*
|
||||||
|
* Note that this does NOT extend SearchJob.
|
||||||
*/
|
*/
|
||||||
public class FloodSearchJob extends JobImpl {
|
public class FloodSearchJob extends JobImpl {
|
||||||
protected Log _log;
|
protected Log _log;
|
||||||
|
@ -258,6 +258,8 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
|
|||||||
/**
|
/**
|
||||||
* Ok, the initial set of searches to the floodfill peers timed out, lets fall back on the
|
* Ok, the initial set of searches to the floodfill peers timed out, lets fall back on the
|
||||||
* wider kademlia-style searches
|
* wider kademlia-style searches
|
||||||
|
*
|
||||||
|
* Unused - called only by FloodSearchJob which is overridden - don't use this.
|
||||||
*/
|
*/
|
||||||
void searchFull(Hash key, List<Job> onFind, List<Job> onFailed, long timeoutMs, boolean isLease) {
|
void searchFull(Hash key, List<Job> onFind, List<Job> onFailed, long timeoutMs, boolean isLease) {
|
||||||
synchronized (_activeFloodQueries) { _activeFloodQueries.remove(key); }
|
synchronized (_activeFloodQueries) { _activeFloodQueries.remove(key); }
|
||||||
|
@ -827,6 +827,7 @@ public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
|||||||
* will fire the appropriate jobs on success or timeout (or if the kademlia search completes
|
* will fire the appropriate jobs on success or timeout (or if the kademlia search completes
|
||||||
* without any match)
|
* without any match)
|
||||||
*
|
*
|
||||||
|
* Unused - called only by FNDF.searchFull() from FloodSearchJob which is overridden - don't use this.
|
||||||
*/
|
*/
|
||||||
SearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease) {
|
SearchJob search(Hash key, Job onFindJob, Job onFailedLookupJob, long timeoutMs, boolean isLease) {
|
||||||
if (!_initialized) return null;
|
if (!_initialized) return null;
|
||||||
|
Reference in New Issue
Block a user