Exemplo n.º 1
0
	/**
	 * Encodes a value of type {@link Octets}.
	 * 
	 * @param output
	 *            The {@link OutputStream} to write the value to.
	 * @param value
	 *            The value to encode.
	 * @throws NullPointerException
	 *             Thrown if either {@link output} or {@link value} is
	 *             <i>null</i>.
	 */
	public static void encode(OutputStream output, Octets value)
			throws NullPointerException {
		Assert.AssertNotNull(output, "output");
		Assert.AssertNotNull(value, "value");

		for (Iterator<Integer> it = value.iterator(); it.hasNext(); /* Nothing */) {
			output.append(it.next());
		}
	}
Exemplo n.º 2
0
	/**
	 * Determines the encoded length for a value of type {@link Octets}.
	 * 
	 * @param value
	 *            The octets to get the encoded length for.
	 * @return The encoded length of the passed value.
	 * @throws NullPointerException
	 *             Thrown if {@link value} is <i>null</i>.
	 */
	public static int encodedLength(Octets value) throws NullPointerException {
		Assert.AssertNotNull(value, "value");

		return value.size();
	}