Determines whether or not class bytes can be transformed.

@param bytes the class bytes
@return true if the class can be transformed
422175
private static boolean isTransformPossible(byte[] bytes) {
        if (bytes.length < 8) {
            return false;
        }
		
        // The transform method will be called for all classes, but ASM is only
        // capable of processing some class file format versions.  That's ok
        // because the transformer only modifies classes that have been
        // preprocessed by our build anyway.
        //
        // ASM doesn't provide a way to determine its max supported version, so
        // we hard code the supported version number.
        int classFileVersion = ((bytes[6] & 0xff) << 8) | (bytes[7] & 0xff);
        
        //Limit bytecode that we transform based on JDK retransform compatibility
        //If we have issues here, 1.8 classes will be instead handled by a separate
        //transformer that only does those classes.
        if (isJDK8WithHotReplaceBug)
        	return classFileVersion == Opcodes.V1_8;
        else
        	return false; //Don't do anything except 1.8 classes on specific JDKs
    }
167687
public static boolean isJdkImmutable(Class<?> type) {
        
    	if (Class.class == type) {
    		return true;
    	}
        if (String.class == type) {
            return true;
        }
        if (BigInteger.class == type) {
            return true;
        }
        if (BigDecimal.class == type) {
            return true;
        }
        if (URL.class == type) {
            return true;
        }
        if (UUID.class == type) {
            return true;
        }
        if (URI.class == type) {
            return true;
        }
        if (Pattern.class == type) {
            return true;
        }
        return false;
    }
843518
public Serializable deserializeFromBytes(final byte[] bytes) {
        Serializable o = null;
        try (final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
            final ObjectInputStream ois = new RestrictedObjectInputStream(bais, this.trustedPackages, this.trustedClasses)) {
            o = (Serializable) ois.readObject();
        } catch (final IOException | ClassNotFoundException e) {
            logger.warn("cannot Java deserialize object", e);
        }
        return o;
    }
1150181
public byte[] transform(byte[] classfileBuffer, Configuration configuration) {
		InstrumentationActions instrumentationActions = calculateTransformationParameters(classfileBuffer, configuration);
		if (!instrumentationActions.includeClass) {
			return classfileBuffer;
		}
		return transform(classfileBuffer, instrumentationActions);
	}
957701
static boolean isBshAssignable( Class toType, Class fromType )
    {
        try {
            return castObject(
                toType, fromType, null/*fromValue*/,
                ASSIGNMENT, true/*checkOnly*/
            ) == VALID_CAST;
        } catch ( UtilEvalError e ) {
            // This should not happen with checkOnly true
            throw new InterpreterError("err in cast check: "+e, e);
        }
    }
124150
public boolean equal(final byte[] bytes) {
        if (bytes == null || count != bytes.length) return false;
        for (int i = 0; i < count; i++) {
            if (content[i] != bytes[i]) return false;
        }
        return true;
    }
422804
public static String encodeBytes(byte[] bytes)
    {
        String ret = null;

        try
        {
            // Obfuscate the string
            if(bytes != null)
                ret = new String(Base64.encodeBase64(bytes));
        }
        catch(NoClassDefFoundError e)
        {
            ret = new String(bytes);
            System.out.println("WARNING: unable to encode: "
                +e.getClass().getName()+": "+e.getMessage());
        }

        return ret;
    }
876817
def is_bytes(string):
    
    if six.PY3 and isinstance(string, (bytes, memoryview, bytearray)):  # noqa
        return True
    elif six.PY2 and isinstance(string, (buffer, bytearray)):  # noqa
        return True
    return False
530032
@Override
	public boolean canConvert(Class<?> fromType, Class<?> toType) {
		return String.class.equals(fromType) && Date.class.equals(toType);
	}
114605
public Response transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] origBytes) throws IllegalClassFormatException {

    byte[] transformed = first.transform(loader, className, classBeingRedefined, protectionDomain, origBytes);

    boolean firstEnhanced = (transformed != null);
    byte[] nextBytes = (transformed != null) ? transformed : origBytes;
    byte[] finalTransformed = second.transform(loader, className, classBeingRedefined, protectionDomain, nextBytes);

    if (finalTransformed != null) {
      return new Response(finalTransformed, firstEnhanced, true);

    } else if (transformed != null) {
      return new Response(transformed, firstEnhanced, false);
    }
    return Response.NOT_TRANSFORMED;
  }
1242630
public static Object bytesToObject(byte[] bytes) throws IOException,
      ClassNotFoundException {
    ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
    ObjectInputStream is = new ObjectInputStream(bais);
    return is.readObject();
  }
137199
private <T> T decode(byte[] bytes) {
    return bytes != null ? serializer.decode(bytes) : null;
  }
57189
private boolean isGZip(byte[] bytes) {
        if(bytes == null || bytes.length == 0) {
            return false;
        }

        // refer http://www.gzip.org/zlib/rfc-gzip.html#file-format for magic numbers
        if(bytes[0] == 31 && (bytes[1] == 0x8b || bytes[1] == -117)) {
            return true;
        }

        return false;
    }
194714
public static Object fromBytes(byte[] b, Class<?> clazz)
    {

        if (clazz.isAssignableFrom(String.class))
        {
            return Bytes.toString(b);
        }
        else if (clazz.equals(int.class) || clazz.isAssignableFrom(Integer.class))
        {
            return Bytes.toInt(b);
        }
        else if (clazz.equals(long.class) || clazz.isAssignableFrom(Long.class))
        {
            return Bytes.toLong(b);
        }
        else if (clazz.equals(boolean.class) || clazz.isAssignableFrom(Boolean.class))
        {
            return Bytes.toBoolean(b);
        }
        else if (clazz.equals(double.class) || clazz.isAssignableFrom(Double.class))
        {
            return Bytes.toDouble(b);
        }
        else if (clazz.equals(float.class) || clazz.isAssignableFrom(Float.class))
        {
            return Bytes.toFloat(b);
        }
        else if (clazz.equals(short.class) || clazz.isAssignableFrom(Short.class))
        {
            return Bytes.toShort(b);
        }
        else if (clazz.equals(BigDecimal.class))
        {
            return Bytes.toBigDecimal(b);
        }
        else
        {
            return PropertyAccessorFactory.getPropertyAccessor(clazz).fromBytes(clazz, b);
        }
    }
468266
public static boolean isPotentiallyEncryptedBytes(byte[] bytes) {
        checkNotNull(bytes, "bytes");

        // The number of bytes is a non-zero multiple of the block size.
        try {
            return bytes.length != 0 && bytes.length % Cipher.getInstance(CIPHER).getBlockSize() == 0;
        } catch (Throwable t) {
            // This shouldn't happen since AES is supported by all JVMs.
            throw Throwables.propagate(t);
        }
    }
909230
public boolean isAssignable(Type t, Type s, Warner warn) {
        if (t.hasTag(ERROR))
            return true;
        if (t.getTag().isSubRangeOf(INT) && t.constValue() != null) {
            int value = ((Number)t.constValue()).intValue();
            switch (s.getTag()) {
            case BYTE:
            case CHAR:
            case SHORT:
            case INT:
                if (s.getTag().checkRange(value))
                    return true;
                break;
            case CLASS:
                switch (unboxedType(s).getTag()) {
                case BYTE:
                case CHAR:
                case SHORT:
                    return isAssignable(t, unboxedType(s), warn);
                }
                break;
            }
        }
        return isConvertible(t, s, warn);
    }
234439
public <T> T deserialize(final byte[] bytes) {
    return kryoInputPool.run(input -> {
      input.setInputStream(new ByteArrayInputStream(bytes));
      return kryoPool.run(kryo -> {
        @SuppressWarnings("unchecked")
        T obj = (T) kryo.readClassAndObject(input);
        return obj;
      });
    }, DEFAULT_BUFFER_SIZE);
  }