List of usage examples for org.apache.commons.codec.binary Hex Hex
public Hex()
From source file:org.apache.openaz.xacml.std.datatypes.HexBinary.java
/** * Creates a new <code>HexBinary</code> by parsing the given <code>String</code> as hex binary data. * * @param stringHexBinary the <code>String</code> to convert * @return a new <code>HexBinary</code> from the converted <code>String</code>. */// ww w . j av a2 s . c o m public static HexBinary newInstance(String stringHexBinary) throws DecoderException { if (stringHexBinary == null) { return null; } byte[] hexBytes = (byte[]) new Hex().decode(stringHexBinary); return new HexBinary(hexBytes); }
From source file:org.apache.tapestry.engine.AbstractEngine.java
/** * Invoked from {@link #setupForRequest(RequestContext)} to provide * an instance of {@link ResourceChecksumSource} that will be stored into * the {@link ServletContext}. Subclasses may override this method * to provide a different implementation. * @return an instance of {@link ResourceChecksumSourceImpl} that uses MD5 and Hex encoding. * @since 3.0.3/*from w ww. java2 s .c om*/ */ protected ResourceChecksumSource createResourceChecksumSource() { return new ResourceChecksumSourceImpl("MD5", new Hex()); }
From source file:org.brunocvcunha.instagram4j.util.InstagramHashUtil.java
/** * Generate a Hmac SHA-256 hash/*from www.j a v a 2s . c o m*/ * @param key key * @param string value * @return hashed */ public static String generateHash(String key, String string) { SecretKeySpec object = new SecretKeySpec(key.getBytes(), "HmacSHA256"); try { Mac mac = Mac.getInstance("HmacSHA256"); mac.init((Key) object); byte[] byteArray = mac.doFinal(string.getBytes("UTF-8")); return new String(new Hex().encode(byteArray), "ISO-8859-1"); } catch (Exception e) { e.printStackTrace(); } return null; }
From source file:org.eclipse.dirigible.runtime.scripting.AbstractScriptExecutor.java
@Override public void registerDefaultVariables(HttpServletRequest request, HttpServletResponse response, Object input, Map<Object, Object> executionContext, IRepository repository, Object scope) { InjectedAPIBuilder apiBuilder = new InjectedAPIBuilder(); if (executionContext == null) { // in case executionContext is not provided from outside executionContext = new HashMap<Object, Object>(); }/*from w w w . j av a 2s . com*/ // Objects // put the execution context registerDefaultVariable(scope, IInjectedAPIAliases.EXECUTION_CONTEXT, executionContext); apiBuilder.setExecutionContext(executionContext); // put the console Console console = new Console(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.CONSOLE, console); apiBuilder.setConsole(console); // put the system out registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.SYSTEM_OUTPUT, System.out); apiBuilder.setSystemOutput(System.out); // put the default data source DataSource dataSource = null; dataSource = registerDefaultDatasource(request, executionContext, scope, apiBuilder); // put request registerRequest(request, executionContext, scope, apiBuilder); // put response registerResponse(response, executionContext, scope, apiBuilder); // put repository registerRepository(executionContext, repository, scope, apiBuilder); // user name registerUserName(request, executionContext, scope, apiBuilder); // the input from the execution chain if any registerRequestInput(input, executionContext, scope, apiBuilder); // put JNDI registerInitialContext(request, executionContext, scope, apiBuilder); // Simple binary storage registerBinaryStorage(executionContext, scope, apiBuilder, dataSource); // Simple file storage registerFileStorage(executionContext, scope, apiBuilder, dataSource); // Simple configuration storage registerConfigurationStorage(executionContext, scope, apiBuilder, dataSource); // Services // put mail sender registerMailService(request, executionContext, scope, apiBuilder); // Extension Manager registerExtensionManager(request, executionContext, repository, scope, apiBuilder, dataSource); // Apache Lucene Indexer registerIndexingService(executionContext, scope, apiBuilder); // Connectivity Configuration service registerConnectivityService(executionContext, scope, apiBuilder); // Document service registerDocumentService(executionContext, scope, apiBuilder); // Messaging Service registerMessagingService(request, executionContext, scope, apiBuilder, dataSource); // Templating Service registerTemplatingService(executionContext, scope, apiBuilder); // Executing Service registerExecutingService(executionContext, scope, apiBuilder); // Generation Service registerGenerationService(executionContext, scope, apiBuilder); // Lifecycle Service registerLifecycleService(executionContext, scope, apiBuilder); // Workspaces Service registerWorkspacesService(executionContext, scope, apiBuilder); // Utils // put Apache Commons IOUtils IOUtils ioUtils = new IOUtils(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.IO_UTILS, ioUtils); apiBuilder.setIOUtils(ioUtils); // put Apache Commons HttpClient and related classes wrapped with a factory like HttpUtils HttpUtils httpUtils = new HttpUtils(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.HTTP_UTILS, httpUtils); apiBuilder.setHttpUtils(httpUtils); // put Apache Commons Codecs Base64 base64Codec = new Base64(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.BASE64_UTILS, base64Codec); apiBuilder.setBase64Utils(base64Codec); Hex hexCodec = new Hex(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.HEX_UTILS, hexCodec); apiBuilder.setHexUtils(hexCodec); DigestUtils digestUtils = new DigestUtils(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.DIGEST_UTILS, digestUtils); apiBuilder.setDigestUtils(digestUtils); // standard URLEncoder and URLDecoder functionality URLUtils urlUtils = new URLUtils(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.URL_UTILS, urlUtils); apiBuilder.setUrlUtils(urlUtils); // file upload ServletFileUpload fileUpload = new ServletFileUpload(new DiskFileItemFactory()); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.UPLOAD_UTILS, fileUpload); apiBuilder.setUploadUtils(fileUpload); // UUID UUID uuid = new UUID(0, 0); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.UUID_UTILS, uuid); apiBuilder.setUuidUtils(uuid); // DbUtils DbUtils dbUtils = new DbUtils(dataSource); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.DB_UTILS, dbUtils); apiBuilder.setDatabaseUtils(dbUtils); // EscapeUtils StringEscapeUtils stringEscapeUtils = new StringEscapeUtils(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.XSS_UTILS, stringEscapeUtils); apiBuilder.setXssUtils(stringEscapeUtils); // XML to JSON and vice-versa XMLUtils xmlUtils = new XMLUtils(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.XML_UTILS, xmlUtils); apiBuilder.setXmlUtils(xmlUtils); // ExceptionUtils ExceptionUtils exceptionUtils = new ExceptionUtils(); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.EXCEPTION_UTILS, exceptionUtils); apiBuilder.setExceptionUtils(exceptionUtils); // Named DataSources Utils NamedDataSourcesUtils namedDataSourcesUtils = new NamedDataSourcesUtils(request); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.DATASOURCES_UTILS, namedDataSourcesUtils); apiBuilder.setNamedDataSourcesUtils(namedDataSourcesUtils); // register objects via extension try { BundleContext context = RuntimeActivator.getContext(); if (context != null) { Collection<ServiceReference<IContextService>> serviceReferences = context .getServiceReferences(IContextService.class, null); for (ServiceReference<IContextService> serviceReference : serviceReferences) { try { IContextService contextService = context.getService(serviceReference); registerDefaultVariableInContextAndScope(executionContext, scope, contextService.getName(), contextService.getInstance()); apiBuilder.set(contextService.getName(), contextService.getInstance()); } catch (Throwable t) { logger.error(t.getMessage(), t); } } } } catch (InvalidSyntaxException e) { logger.error(e.getMessage(), e); } InjectedAPIWrapper api = new InjectedAPIWrapper(apiBuilder); registerDefaultVariableInContextAndScope(executionContext, scope, IInjectedAPIAliases.API, api); }
From source file:org.esupportail.papercut.services.HashService.java
public String getHMac(String input) { try {/*from w ww. ja v a 2 s. co m*/ Mac mac = Mac.getInstance("HmacSHA512"); mac.init(secretKey); final byte[] macData = mac.doFinal(input.getBytes()); byte[] hex = new Hex().encode(macData); String hmac = new String(hex, "ISO-8859-1").toUpperCase(); log.debug(input); log.debug(hmac); return hmac; } catch (Exception e) { log.error("Error during encoding data ..."); throw new RuntimeException(e); } }
From source file:org.freedesktop.dbus.Message.java
/** * Marshalls an integer of a given width into a buffer. * Endianness is determined from the message. * //from ww w .j a v a 2 s. c om * @param l * The integer to marshall. * @param buf * The buffer to marshall to. * @param ofs * The offset to marshall to. * @param width * The byte-width of the int. */ public void marshallint(long l, byte[] buf, int ofs, int width) { if (this.big) marshallintBig(l, buf, ofs, width); else marshallintLittle(l, buf, ofs, width); if (log.isTraceEnabled()) { Hex h = new Hex(); log.trace("Marshalled int " + l + " to " + h.encode(Arrays.copyOfRange(buf, ofs, width))); } }
From source file:org.freedesktop.dbus.Message.java
/** * Demarshall one value from a buffer.//from w w w . j av a2 s. c o m * * @param sigb * A buffer of the D-Bus signature. * @param buf * The buffer to demarshall from. * @param ofs * An array of two ints, the offset into the signature buffer * and the offset into the data buffer. These values will be * updated to the start of the next value ofter demarshalling. * @param contained * converts nested arrays to Lists * @return The demarshalled value. */ private Object extractone(byte[] sigb, byte[] buf, int[] ofs, boolean contained) throws DBusException { if (log.isTraceEnabled()) { log.trace("Extracting type: " + ((char) sigb[ofs[0]]) + " from offset " + ofs[1]); } Object rv = null; ofs[1] = align(ofs[1], sigb[ofs[0]]); switch (sigb[ofs[0]]) { case ArgumentType.BYTE: rv = buf[ofs[1]++]; break; case ArgumentType.UINT32: rv = new UInt32(demarshallint(buf, ofs[1], 4)); ofs[1] += 4; break; case ArgumentType.INT32: rv = (int) demarshallint(buf, ofs[1], 4); ofs[1] += 4; break; case ArgumentType.INT16: rv = (short) demarshallint(buf, ofs[1], 2); ofs[1] += 2; break; case ArgumentType.UINT16: rv = new UInt16((int) demarshallint(buf, ofs[1], 2)); ofs[1] += 2; break; case ArgumentType.INT64: rv = demarshallint(buf, ofs[1], 8); ofs[1] += 8; break; case ArgumentType.UINT64: long top; long bottom; if (this.big) { top = demarshallint(buf, ofs[1], 4); ofs[1] += 4; bottom = demarshallint(buf, ofs[1], 4); } else { bottom = demarshallint(buf, ofs[1], 4); ofs[1] += 4; top = demarshallint(buf, ofs[1], 4); } rv = new UInt64(top, bottom); ofs[1] += 4; break; case ArgumentType.DOUBLE: long l = demarshallint(buf, ofs[1], 8); ofs[1] += 8; rv = Double.longBitsToDouble(l); break; case ArgumentType.FLOAT: int rf = (int) demarshallint(buf, ofs[1], 4); ofs[1] += 4; rv = Float.intBitsToFloat(rf); break; case ArgumentType.BOOLEAN: rf = (int) demarshallint(buf, ofs[1], 4); ofs[1] += 4; rv = (1 == rf) ? Boolean.TRUE : Boolean.FALSE; break; case ArgumentType.ARRAY: long size = demarshallint(buf, ofs[1], 4); if (log.isTraceEnabled()) { log.trace("Reading array of size: " + size); } ofs[1] += 4; byte algn = (byte) getAlignment(sigb[++ofs[0]]); ofs[1] = align(ofs[1], sigb[ofs[0]]); int length = (int) (size / algn); if (length > AbstractConnection.MAX_ARRAY_LENGTH) throw new MarshallingException("Arrays must not exceed " + AbstractConnection.MAX_ARRAY_LENGTH); // optimise primatives switch (sigb[ofs[0]]) { case ArgumentType.BYTE: rv = new byte[length]; System.arraycopy(buf, ofs[1], rv, 0, length); ofs[1] += size; break; case ArgumentType.INT16: rv = new short[length]; for (int j = 0; j < length; j++, ofs[1] += algn) ((short[]) rv)[j] = (short) demarshallint(buf, ofs[1], algn); break; case ArgumentType.INT32: rv = new int[length]; for (int j = 0; j < length; j++, ofs[1] += algn) ((int[]) rv)[j] = (int) demarshallint(buf, ofs[1], algn); break; case ArgumentType.INT64: rv = new long[length]; for (int j = 0; j < length; j++, ofs[1] += algn) ((long[]) rv)[j] = demarshallint(buf, ofs[1], algn); break; case ArgumentType.BOOLEAN: rv = new boolean[length]; for (int j = 0; j < length; j++, ofs[1] += algn) ((boolean[]) rv)[j] = (1 == demarshallint(buf, ofs[1], algn)); break; case ArgumentType.FLOAT: rv = new float[length]; for (int j = 0; j < length; j++, ofs[1] += algn) ((float[]) rv)[j] = Float.intBitsToFloat((int) demarshallint(buf, ofs[1], algn)); break; case ArgumentType.DOUBLE: rv = new double[length]; for (int j = 0; j < length; j++, ofs[1] += algn) ((double[]) rv)[j] = Double.longBitsToDouble(demarshallint(buf, ofs[1], algn)); break; case ArgumentType.DICT_ENTRY1: if (0 == size) { // advance the type parser even on 0-size arrays. Vector<Type> temp = new Vector<>(); byte[] temp2 = new byte[sigb.length - ofs[0]]; System.arraycopy(sigb, ofs[0], temp2, 0, temp2.length); String temp3 = new String(temp2); // ofs[0] gets incremented anyway. Leave one character on the stack int temp4 = Marshalling.getJavaType(temp3, temp, 1) - 1; ofs[0] += temp4; if (log.isTraceEnabled()) { log.trace("Aligned type: " + temp3 + " " + temp4 + " " + ofs[0]); } } int ofssave = ofs[0]; long end = ofs[1] + size; Vector<Object[]> entries = new Vector<>(); while (ofs[1] < end) { ofs[0] = ofssave; entries.add((Object[]) extractone(sigb, buf, ofs, true)); } rv = new DBusMap<>(entries.toArray(new Object[0][])); break; default: if (0 == size) { // advance the type parser even on 0-size arrays. Vector<Type> temp = new Vector<>(); byte[] temp2 = new byte[sigb.length - ofs[0]]; System.arraycopy(sigb, ofs[0], temp2, 0, temp2.length); String temp3 = new String(temp2); // ofs[0] gets incremented anyway. Leave one character on the stack int temp4 = Marshalling.getJavaType(temp3, temp, 1) - 1; ofs[0] += temp4; if (log.isTraceEnabled()) { log.trace("Aligned type: " + temp3 + " " + temp4 + " " + ofs[0]); } } ofssave = ofs[0]; end = ofs[1] + size; Vector<Object> contents = new Vector<>(); while (ofs[1] < end) { ofs[0] = ofssave; contents.add(extractone(sigb, buf, ofs, true)); } rv = contents; } if (contained && !(rv instanceof List) && !(rv instanceof Map)) rv = ArrayFrob.listify(rv); break; case ArgumentType.STRUCT1: Vector<Object> contents = new Vector<>(); while (sigb[++ofs[0]] != ArgumentType.STRUCT2) contents.add(extractone(sigb, buf, ofs, true)); rv = contents.toArray(); break; case ArgumentType.DICT_ENTRY1: Object[] decontents = new Object[2]; if (log.isTraceEnabled()) { Hex h = new Hex(); log.trace( "Extracting Dict Entry (" + h.encode(Arrays.copyOfRange(sigb, ofs[0], sigb.length - ofs[0])) + ") from: " + h.encode(Arrays.copyOfRange(buf, ofs[1], buf.length - ofs[1]))); } ofs[0]++; decontents[0] = extractone(sigb, buf, ofs, true); ofs[0]++; decontents[1] = extractone(sigb, buf, ofs, true); ofs[0]++; rv = decontents; break; case ArgumentType.VARIANT: int[] newofs = new int[] { 0, ofs[1] }; String sig = (String) extract(ArgumentType.SIGNATURE_STRING, buf, newofs)[0]; newofs[0] = 0; rv = new Variant<>(extract(sig, buf, newofs)[0], sig); ofs[1] = newofs[1]; break; case ArgumentType.STRING: length = (int) demarshallint(buf, ofs[1], 4); ofs[1] += 4; try { rv = new String(buf, ofs[1], length, "UTF-8"); } catch (UnsupportedEncodingException UEe) { throw new DBusException("System does not support UTF-8 encoding", UEe); } ofs[1] += length + 1; break; case ArgumentType.OBJECT_PATH: length = (int) demarshallint(buf, ofs[1], 4); ofs[1] += 4; rv = new ObjectPath(getSource(), new String(buf, ofs[1], length)); ofs[1] += length + 1; break; case ArgumentType.SIGNATURE: length = (buf[ofs[1]++] & 0xFF); rv = new String(buf, ofs[1], length); ofs[1] += length + 1; break; default: throw new UnknownTypeCodeException(sigb[ofs[0]]); } if (log.isDebugEnabled()) { if (rv instanceof Object[]) log.trace("Extracted: " + Arrays.deepToString((Object[]) rv) + " (now at " + ofs[1] + ")"); else log.trace("Extracted: " + rv + " (now at " + ofs[1] + ")"); } return rv; }
From source file:org.freedesktop.dbus.MessageReader.java
public Message readMessage() throws IOException, DBusException { int rv;//from w ww.j a v a 2 s .c om /* Read the 12 byte fixed header, retrying as neccessary */ if (null == this.buf) { this.buf = new byte[12]; this.len[0] = 0; } if (this.len[0] < 12) { try { rv = this.in.read(this.buf, this.len[0], 12 - this.len[0]); } catch (SocketTimeoutException STe) { return null; } if (-1 == rv) throw new EOFException("Underlying transport returned EOF"); this.len[0] += rv; } if (this.len[0] == 0) return null; if (this.len[0] < 12) { if (log.isDebugEnabled()) { log.debug("Only got " + this.len[0] + " of 12 bytes of header"); } return null; } /* Parse the details from the header */ byte endian = this.buf[0]; byte type = this.buf[1]; byte protover = this.buf[3]; if (protover > Message.PROTOCOL) { this.buf = null; throw new MessageProtocolVersionException( String.format("Protocol version %s is unsupported", protover)); } /* Read the length of the variable header */ if (null == this.tbuf) { this.tbuf = new byte[4]; this.len[1] = 0; } if (this.len[1] < 4) { try { rv = this.in.read(this.tbuf, this.len[1], 4 - this.len[1]); } catch (SocketTimeoutException STe) { log.debug("Socket timeout", STe); return null; } if (-1 == rv) throw new EOFException("Underlying transport returned EOF"); this.len[1] += rv; } if (this.len[1] < 4) { if (log.isDebugEnabled()) { log.debug("Only got " + this.len[1] + " of 4 bytes of header"); } return null; } /* Parse the variable header length */ int headerlen = 0; if (null == this.header) { headerlen = (int) Message.demarshallint(this.tbuf, 0, endian, 4); if (0 != headerlen % 8) headerlen += 8 - (headerlen % 8); } else headerlen = this.header.length - 8; /* Read the variable header */ if (null == this.header) { this.header = new byte[headerlen + 8]; System.arraycopy(this.tbuf, 0, this.header, 0, 4); this.len[2] = 0; } if (this.len[2] < headerlen) { try { rv = this.in.read(this.header, 8 + this.len[2], headerlen - this.len[2]); } catch (SocketTimeoutException STe) { log.debug("Socket timeout", STe); return null; } if (-1 == rv) throw new EOFException("Underlying transport returned EOF"); this.len[2] += rv; } if (this.len[2] < headerlen) { if (log.isDebugEnabled()) { log.debug("Only got " + this.len[2] + " of " + headerlen + " bytes of header"); } return null; } /* Read the body */ int bodylen = 0; if (null == this.body) bodylen = (int) Message.demarshallint(this.buf, 4, endian, 4); if (null == this.body) { this.body = new byte[bodylen]; this.len[3] = 0; } if (this.len[3] < this.body.length) { try { rv = this.in.read(this.body, this.len[3], this.body.length - this.len[3]); } catch (SocketTimeoutException STe) { log.debug("Socket timeout", STe); return null; } if (-1 == rv) throw new EOFException("Underlying transport returned EOF"); this.len[3] += rv; } if (this.len[3] < this.body.length) { if (log.isDebugEnabled()) { log.debug("Only got " + this.len[3] + " of " + this.body.length + " bytes of body"); } return null; } Message m; switch (type) { case Message.MessageType.METHOD_CALL: m = new MethodCall(); break; case Message.MessageType.METHOD_RETURN: m = new MethodReturn(); break; case Message.MessageType.SIGNAL: m = new DBusSignal(); break; case Message.MessageType.ERROR: m = new Error(); break; default: throw new MessageTypeException(String.format("Message type %s unsupported", type)); } if (log.isTraceEnabled()) { Hex h = new Hex(); log.trace(h.encode(this.buf)); log.trace(h.encode(this.tbuf)); log.trace(h.encode(this.header)); log.trace(h.encode(this.body)); } try { m.populate(this.buf, this.header, this.body); } catch (DBusException DBe) { this.buf = null; this.tbuf = null; this.body = null; this.header = null; throw DBe; } catch (RuntimeException Re) { this.buf = null; this.tbuf = null; this.body = null; this.header = null; throw Re; } log.info("=> " + m); this.buf = null; this.tbuf = null; this.body = null; this.header = null; return m; }
From source file:org.freedesktop.dbus.MessageWriter.java
public void writeMessage(Message m) throws IOException { log.info("<= " + m); if (null == m) return;//from w w w.j a v a2 s.c o m if (null == m.getWireData()) { log.warn("Message " + m + " wire-data was null!"); return; } for (byte[] buf : m.getWireData()) { if (log.isTraceEnabled()) { Hex h = new Hex(); log.trace("(" + buf + "):" + (null == buf ? "" : h.encode(buf))); } if (null == buf) break; this.out.write(buf); } this.out.flush(); }
From source file:org.freedesktop.dbus.MethodCall.java
public MethodCall(String source, String dest, String path, String iface, String member, byte flags, String sig, Object... args) throws DBusException { super(Message.Endian.BIG, Message.MessageType.METHOD_CALL, flags); if (null == member || null == path) throw new MessageFormatException("Must specify destination, path and function name to MethodCalls."); this.headers.put(Message.HeaderField.PATH, path); this.headers.put(Message.HeaderField.MEMBER, member); Vector<Object> hargs = new Vector<>(); hargs.add(//from ww w. j a v a 2 s . c o m new Object[] { Message.HeaderField.PATH, new Object[] { ArgumentType.OBJECT_PATH_STRING, path } }); if (null != source) { this.headers.put(Message.HeaderField.SENDER, source); hargs.add(new Object[] { Message.HeaderField.SENDER, new Object[] { ArgumentType.STRING_STRING, source } }); } if (null != dest) { this.headers.put(Message.HeaderField.DESTINATION, dest); hargs.add(new Object[] { Message.HeaderField.DESTINATION, new Object[] { ArgumentType.STRING_STRING, dest } }); } if (null != iface) { hargs.add(new Object[] { Message.HeaderField.INTERFACE, new Object[] { ArgumentType.STRING_STRING, iface } }); this.headers.put(Message.HeaderField.INTERFACE, iface); } hargs.add(new Object[] { Message.HeaderField.MEMBER, new Object[] { ArgumentType.STRING_STRING, member } }); if (null != sig) { if (log.isDebugEnabled()) { log.debug("Appending arguments with signature: " + sig); } hargs.add(new Object[] { Message.HeaderField.SIGNATURE, new Object[] { ArgumentType.SIGNATURE_STRING, sig } }); this.headers.put(Message.HeaderField.SIGNATURE, sig); setArgs(args); } byte[] blen = new byte[4]; appendBytes(blen); append("ua(yv)", this.serial, hargs.toArray()); pad((byte) 8); long c = this.bytecounter; if (null != sig) append(sig, args); if (log.isDebugEnabled()) { log.debug("Appended body, type: " + sig + " start: " + c + " end: " + this.bytecounter + " size: " + (this.bytecounter - c)); } marshallint(this.bytecounter - c, blen, 0, 4); if (log.isDebugEnabled()) { Hex h = new Hex(); log.debug("marshalled size (" + blen + "): " + h.encode(blen)); } }