Returns the {@link Byte} array message digest of {@link #getResourceInputStream()} using the given
{@link MessageDigest}.
189331
public static byte[] getDigest(Resource<?> resource, MessageDigest digest)
   {
      try (InputStream stream = resource.getResourceInputStream();
               DigestInputStream digestStream = new DigestInputStream(stream, digest))
      {
         byte[] buffer = new byte[16384];
         while (digestStream.read(buffer, 0, buffer.length) != -1)
         {
         }
      }
      catch (IOException e)
      {
         throw new IllegalStateException("Error calculating digest for resource [" + resource.getFullyQualifiedName()
                  + "]", e);
      }
      return digest.digest();
   }
496239
public static byte[] hashPath(MessageDigest messageDigest, Path path) throws IOException {
        try (InputStream in = getRecursiveContentStream(path)) {
            return hashContent(messageDigest, in);
        }
    }
680800
public static byte[] getBytes(final InputStream sourceInputStream) throws IOException {

    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    byte[] buffer = new byte[BUFFER_SIZE];
    for (int len = 0; (len = sourceInputStream.read(buffer)) != -1;) {
      byteArrayOutputStream.write(buffer, 0, len);
    }
    byte[] arrayOfByte = byteArrayOutputStream.toByteArray();
    return arrayOfByte;
  }
1107945
public byte[] getMessage() {
        byte result[] = new byte[events.length + 7];

        result[0] = (byte)(byteCount = events.length + 6);
        result[1] = (byte)(status >> 8);
        result[2] = (byte)(status & 0xFF);
        result[3] = (byte)(eventCount >> 8);
        result[4] = (byte)(eventCount & 0xFF);
        result[5] = (byte)(messageCount >> 8);
        result[6] = (byte)(messageCount & 0xFF);

        System.arraycopy(events, 0, result, 7, events.length);

        return result;
    }
1321123
synchronized static private byte[] getSecret() throws Exception {
		if( null == secret ) {
			Date now = new Date();
			long nowValue = now.getTime();
			
			byte[] nowBytes = new byte[8];
			nowBytes[0] = (byte)((nowValue >>  0) & 0xff);
			nowBytes[1] = (byte)((nowValue >>  8) & 0xff);
			nowBytes[2] = (byte)((nowValue >> 16) & 0xff);
			nowBytes[3] = (byte)((nowValue >> 24) & 0xff);
			nowBytes[4] = (byte)((nowValue >> 32) & 0xff);
			nowBytes[5] = (byte)((nowValue >> 40) & 0xff);
			nowBytes[6] = (byte)((nowValue >> 48) & 0xff);
			nowBytes[7] = (byte)((nowValue >> 56) & 0xff);
			
			MessageDigest md = MessageDigest.getInstance("SHA");
			md.update( nonce );
			md.update( nowBytes );
			secret = md.digest();
		}
		
		return secret;
	}
1215910
public byte[] digest(String algorithm, byte[] bytes) {
        try {
            MessageDigest md = MessageDigest.getInstance(algorithm);
            return md.digest(bytes);
        }
        catch (NoSuchAlgorithmException exception) {
            throw new IllegalStateException(
                "unable to access MD5 algorithm", exception
            );
        }
    }
132980
public byte[] getBytes() {
    final byte[] bytes = new byte[qualifier.length + value.length];
    System.arraycopy(this.qualifier, 0, bytes, 0, qualifier.length);
    System.arraycopy(value, 0, bytes, qualifier.length, value.length);
    return bytes;
  }
265004
static int fillBufferWithDelimitedMessageFrom(InputStream in,
            boolean drainRemainingBytesIfTooLarge,
            LinkedBuffer lb) throws IOException
    {
        final byte[] buf = lb.buffer;
        int offset = lb.start, len = buf.length - offset, read = in.read(buf, offset, len);

        if (read < 1)
            throw new EOFException("fillBufferWithDelimitedMessageFrom");

        int last = offset + read, size = buf[offset++];
        if (0 != (size & 0x80))
        {
            size = size & 0x7f;

            for (int shift = 7;; shift += 7)
            {
                if (offset == last)
                {
                    // read too few bytes
                    read = in.read(buf, last, len - (last - lb.start));
                    if (read < 1)
                        throw new EOFException("fillBufferWithDelimitedMessageFrom");

                    last += read;
                }

                byte b = buf[offset++];
                size |= (b & 0x7f) << shift;

                if (0 == (b & 0x80))
                    break;

                if (shift == 28)
                {
                    // discard the remaining bytes (5)
                    for (int i = 0;;)
                    {
                        if (offset == last)
                        {
                            // read more
                            read = in.read(buf, last, len - (last - lb.start));
                            if (read < 1)
                                throw new EOFException("fillBufferWithDelimitedMessageFrom");

                            last += read;
                        }

                        if (buf[offset++] >= 0)
                            break;

                        if (5 == ++i)
                        {
                            // we've already consumed 10 bytes
                            throw ProtobufException.malformedVarint();
                        }
                    }

                }
            }
        }

        if (size == 0)
        {
            if (offset != last)
                throw ProtobufException.misreportedSize();

            return size;
        }

        if (size < 0)
            throw ProtobufException.negativeSize();

        final int partial = last - offset;
        if (partial < size)
        {
            // need to read more
            final int delimSize = offset - lb.start;
            if ((size + delimSize) > len)
            {
                // too large.

                if (!drainRemainingBytesIfTooLarge)
                    return size;

                // drain the remaining bytes
                for (int remaining = size - partial; remaining > 0;)
                {
                    read = in.read(buf, lb.start, Math.min(remaining, len));
                    if (read < 1)
                        throw new EOFException("fillBufferWithDelimitedMessageFrom");

                    remaining -= read;
                }

                return size;
            }

            // read the remaining bytes
            fillBufferFrom(in, buf, last, size - partial);
        }

        // set the read offset (start of message)
        lb.offset = offset;

        return size;
    }
89560
@Override
    public MessageResourcesGateway getMessageResourceGateway() {
        final MessageResourcesGateway gateway = messageResourcesHolder.getGateway();
        if (gateway == null) {
            String msg = "Not found the gateway for message resource: holder=" + messageResourcesHolder;
            throw new IllegalStateException(msg);
        }
        return gateway;
    }
1374340
public byte[] getBuffer() {
        if(buf == null)
            return null;
        if(offset == 0 && length == buf.length)
            return buf;
        else {
            byte[] retval=new byte[length];
            System.arraycopy(buf, offset, retval, 0, length);
            return retval;
        }
    }
34157
@Override
    public final byte[] getApiMessageIdAsBytes() {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getApiMessageIdAsBytes");

        byte[] value = (byte[]) getApi().getField(JsApiAccess.MESSAGEID);
        if (value != null) {
            byte[] copy = new byte[value.length];
            System.arraycopy(value, 0, copy, 0, value.length);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "getApiMessageIdAsBytes", copy);
            return copy;
        }
        else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "getApiMessageIdAsBytes", null);
            return null;
        }
    }
1059583
public final byte[] getBytes() {
		final int length = bytes.length;
		final byte[] result = new byte[length];

		// Make a defensive copy
		System.arraycopy(bytes, 0, result, 0, length);

		return result;
	}
118901
protected synchronized MessageDigest getDigest() {
        if (this.digest == null) {
            try {
                this.digest = MessageDigest.getInstance(algorithm);
            } catch (NoSuchAlgorithmException e) {
                try {
                    this.digest = MessageDigest.getInstance(DEFAULT_ALGORITHM);
                } catch (NoSuchAlgorithmException f) {
                    this.digest = null;
                }
            }
        }
        return (this.digest);
    }
439047
public ByteBuffer asByteBuffer() {
        ByteBuffer bb = getByteBuffer();
        if (bb != null) return null;
        InputStream is = fromStreamOrUrl();
        if (is != null) return bufferFrom(is);
        String s = fromStringOrReader();
        if (s != null) return bufferFrom(s);
        throw resourceUnaccessible();
    }
313742
private void getMessageDigestMD5() throws AttributeNotFoundException {
        if (MBeans.messageDigestMD5 == null) {
            try {
                MBeans.messageDigestMD5 = MessageDigestUtility.createMessageDigest("MD5");
            } catch (NoSuchAlgorithmException e) {
                Tr.error(tc, "DYNA1044E", new Object[] { e.getMessage() });
                throw new AttributeNotFoundException("Message digest for MD5 is not available. " + e.getMessage());
            }
        }
    }
1217780
public byte[] getBytes() {
    byte[] bytes = new byte[SIZE];
    BigendianEncoding.longToByteArray(idHi, bytes, 0);
    BigendianEncoding.longToByteArray(idLo, bytes, BigendianEncoding.LONG_BYTES);
    return bytes;
  }
147223
public static byte getByte(MemorySegment[] segments, int offset) {
		if (inFirstSegment(segments, offset, 1)) {
			return segments[0].get(offset);
		} else {
			return getByteMultiSegments(segments, offset);
		}
	}