/**
* Helper class with utility methods for the FCP protocol.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class FcpUtils {
/**
* Returns a unique identifier.
- *
+ *
* @return A unique identifier
*/
public static String getUniqueIdentifier() {
/**
* Parses an integer field, separated by ‘;’ and returns the parsed values.
- *
+ *
* @param field
* The field to parse
* @return An array with the parsed values
/**
* Encodes the given integer array into a string, separating the values by
* ‘;’.
- *
+ *
* @param values
* The values to encode
* @return The encoded values
/**
* Encodes the given string array into a string, separating the values by
* ‘;’.
- *
+ *
* @param values
* The values to encode
* @return The encoded values
/**
* Tries to parse the given string into an int, returning <code>-1</code> if
* the string can not be parsed.
- *
+ *
* @param value
* The string to parse
* @return The parsed int, or <code>-1</code>
/**
* Tries to parse the given string into an int, returning
* <code>defaultValue</code> if the string can not be parsed.
- *
+ *
* @param value
* The string to parse
* @param defaultValue
/**
* Tries to parse the given string into an long, returning <code>-1</code>
* if the string can not be parsed.
- *
+ *
* @param value
* The string to parse
* @return The parsed long, or <code>-1</code>
/**
* Tries to parse the given string into an long, returning
* <code>defaultValue</code> if the string can not be parsed.
- *
+ *
* @param value
* The string to parse
* @param defaultValue
/**
* Closes the given socket.
- *
+ *
* @param socket
* The socket to close
*/
/**
* Closes the given Closeable.
- *
+ *
* @param closeable
* The Closeable to close
*/
* Copies as many bytes as possible (i.e. until {@link InputStream#read()}
* returns <code>-1</code>) from the source input stream to the destination
* output stream.
- *
+ *
* @param source
* The input stream to read from
* @param destination
* much bytes as possible will be copied (i.e. until
* {@link InputStream#read()} returns <code>-1</code> to signal the end of
* the stream).
- *
+ *
* @param source
* The input stream to read from
* @param destination
* much bytes as possible will be copied (i.e. until
* {@link InputStream#read()} returns <code>-1</code> to signal the end of
* the stream).
- *
+ *
* @param source
* The input stream to read from
* @param destination
/**
* This input stream stores the content of another input stream either in a
* file or in memory, depending on the length of the input stream.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public static class TempInputStream extends InputStream {
/**
* Creates a new temporary input stream that stores the given input
* stream in a temporary file.
- *
+ *
* @param originalInputStream
* The original input stream
* @throws IOException
* Creates a new temporary input stream that stores the given input
* stream in memory if it is shorter than {@link #MAX_LENGTH_MEMORY},
* otherwise it is stored in a file.
- *
+ *
* @param originalInputStream
* The original input stream
* @param length
* Creates a new temporary input stream that stores the given input
* stream in memory if it is shorter than <code>maxMemoryLength</code>,
* otherwise it is stored in a file.
- *
+ *
* @param originalInputStream
* The original input stream
* @param length