Same as {@link #unmarshallArray(ObjectInput, ArrayBuilder)} but specialized for byte array.
<p>
No {@link ArrayBuilder} is necessary.

@see #unmarshallArray(ObjectInput, ArrayBuilder).
484437
public static byte[] unmarshallByteArray(ObjectInput in) throws IOException {
      final int size = unmarshallSize(in);
      if (size == NULL_VALUE) {
         return null;
      } else if (size == 0) {
         return Util.EMPTY_BYTE_ARRAY;
      }
      byte[] array = new byte[size];
      in.readFully(array);
      return array;
   }
921078
protected Object unmarshal() throws IOException, JSONException {
		json = new JSONTokener(new InputStreamReader(inputStream, "UTF-8")).nextValue();
		inputStream.close();
		return json;
	}
1127545
@Override
  public XMLObject unmarshall(Element domElement) throws UnmarshallingException {

    Document newDocument = null;

    Node childNode = domElement.getFirstChild();
    while (childNode != null) {
      if (childNode.getNodeType() != Node.TEXT_NODE) {
        // We skip everything except for a text node.
        log.info("Ignoring node {} - it is not a text node", childNode.getNodeName());
      }
      else {
        newDocument = parseContents((Text) childNode, domElement);
        if (newDocument != null) {
          break;
        }
      }
      childNode = childNode.getNextSibling();
    }

    return super.unmarshall(newDocument != null ? newDocument.getDocumentElement() : domElement);
  }
1180086
public static Byte[] toObject(byte[] array) {
        if (array == null) {
            return null;
        } else if (array.length == 0) {
            return EMPTY_BYTE_OBJECT_ARRAY;
        }
        final Byte[] result = new Byte[array.length];
        for (int i = 0; i < array.length; i++) {
            result[i] = array[i];
        }
        return result;
    }
728237
public static byte[] toByteArray(InputStream is) throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        try {
            byte[] b = new byte[BUFFER_SIZE];
            int n = 0;
            while ((n = is.read(b)) != -1) {
                output.write(b, 0, n);
            }
            return output.toByteArray();
        } finally {
            output.close();
        }
    }
1105693
public byte[] toByteArray() {
        // computes the real size of the bytecode of this class
        final int interfaceCount = interfaces.length;
        int size = 24 + 2 * interfaceCount;
//        if (fields != null) {
//            size += fields.length;
//        }
        for (MethodWriter cb : this.methods) {
            size += cb.getSize();
        }
//        int attributeCount = 0;
//        if ((access & Constants.ACC_DEPRECATED) != 0) {
//            ++attributeCount;
//            size += 6;
//        }
//        if ((access & Constants.ACC_SYNTHETIC) != 0) {
//            ++attributeCount;
//            size += 6;
//        }
        size += pool.length;
        // allocates a byte vector of this size, in order to avoid unnecessary
        // arraycopy operations in the ByteBuffer.enlarge() method
        final ByteBuffer out = new ByteBuffer(size);
        out.putInt(0xCAFEBABE).putInt(version);
        out.putShort(poolIndex).put(pool);
        out.putShort(access).putShort(name).putShort(superName);
        out.putShort(interfaceCount);
        for (int i = 0; i < interfaceCount; ++i) {
            out.putShort(interfaces[i]);
        }
        out.putShort(0); //out.putShort(fieldCount);
//        if (fields != null) {
//            out.put(fields);
//        }
        out.putShort(this.methods.size());
        for (MethodWriter cb : this.methods) {
            cb.renderTo(out);
        }
        out.putShort(0 /* attributeCount */);
//        if ((access & Constants.ACC_DEPRECATED) != 0) {
//            out.putShort(newUTF8("Deprecated")).putInt(0);
//        }
//        if ((access & Constants.ACC_SYNTHETIC) != 0) {
//            out.putShort(newUTF8("Synthetic")).putInt(0);
//        }
        return out.data;
    }
1258341
public Object unMarshall(String returnType, InputStream is) throws Exception {
        return xmlGen.fromXML(returnType, is);
    }
945736
@Override
    protected final void unserialize(ByteBuffer bytes)
    {
        int indexDataLength = m_dataOffset_ + m_dataLength_;
        m_index_ = ICUBinary.getChars(bytes, indexDataLength, 0);
        m_data_           = m_index_;
        m_initialValue_   = m_data_[m_dataOffset_];
    }
1272528
public static String encodeByteArray(byte[] byteArray) {
		try {
			return new String(Base64.encodeBase64(byteArray), UTF8_ENCODING);
		} catch(UnsupportedEncodingException e) {
			throw new MappingException("Could not encode byteArray to UTF8 encoding", e);
		}
	}
864803
public static byte[] readByteArray(InputStream input) throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        copy(input, output);
        return output.toByteArray();
    }
563973
private void unmarshalIdentifier() throws Throwable {
    IdentifierMetadata identifierMetadata = entityMetadata.getIdentifierMetadata();
    Object id = ((Key) nativeEntity.getKey()).getNameOrId();
    // If the ID is not a simple type...
    IdClassMetadata idClassMetadata = identifierMetadata.getIdClassMetadata();
    if (idClassMetadata != null) {
      Object wrappedId = idClassMetadata.getConstructor().invoke(id);
      id = wrappedId;
    }
    // Now set the ID (either simple or complex) on the Entity
    MethodHandle writeMethod = identifierMetadata.getWriteMethod();
    writeMethod.invoke(entity, id);
  }
887556
byte[] decodeLikeAnEngineer(final byte[] input) {

        if (input == null) {
            throw new NullPointerException("input");
        }

        if ((input.length & 0x01) == 0x01) {
            throw new IllegalArgumentException(
                "input.length(" + input.length + ") is not even");
        }

        final byte[] output = new byte[input.length >> 1];

        int index = 0; // index in input
        for (int i = 0; i < output.length; i++) {
            output[i] = (byte) ((decodeHalf(input[index++]) << 4)
                                | decodeHalf(input[index++]));
        }

        return output;
    }
760469
public final static byte[] readByteArray(final ObjectInputStream s) throws IOException {
		final byte[] a = new byte[readVByte(s)];
		s.readFully(a);
		return a;
	}
45223
public static <T> List<T> unmarshalCollection(Class<T> cl, InputStream s) throws JAXBException {
    return unmarshalCollection(cl, new StreamSource(s));
  }
903865
private void unmarshalEmbeddedFields() throws Throwable {
    for (EmbeddedMetadata embeddedMetadata : entityMetadata.getEmbeddedMetadataCollection()) {
      if (embeddedMetadata.getStorageStrategy() == StorageStrategy.EXPLODED) {
        unmarshalWithExplodedStrategy(embeddedMetadata, entity);
      } else {
        unmarshalWithImplodedStrategy(embeddedMetadata, entity, nativeEntity);
      }
    }
  }
819746
private static void autoUnmarshalEligible(HierarchicalStreamReader reader,
                                              Object o) {
        try {
            String nodeName = reader.getNodeName();
            Class c = o.getClass();
            Field f = null;
            try {
                f = c.getDeclaredField(nodeName);
            } catch (NoSuchFieldException e) {
                UNMARSHALL_ERROR_COUNTER.increment();
            }
            if (f == null) {
                return;
            }
            Annotation annotation = f.getAnnotation(Auto.class);
            if (annotation == null) {
                return;
            }
            f.setAccessible(true);

            String value = reader.getValue();
            Class returnClass = f.getType();
            if (value != null) {
                if (!String.class.equals(returnClass)) {

                    Method method = returnClass.getDeclaredMethod("valueOf",
                            java.lang.String.class);
                    Object valueObject = method.invoke(returnClass, value);
                    f.set(o, valueObject);
                } else {
                    f.set(o, value);

                }
            }
        } catch (Throwable th) {
            logger.error("Error in unmarshalling the object:", th);
        }
    }
875004
@SuppressWarnings({ "rawtypes", "unchecked" })
    private <T> T getCustomMarshalledValue(T toReturn, Method getter, AttributeValue value) {
        DynamoDBMarshalling annotation = getter.getAnnotation(DynamoDBMarshalling.class);
        Class<? extends DynamoDBMarshaller<? extends Object>> marshallerClass = annotation.marshallerClass();

        DynamoDBMarshaller marshaller;
        try {
            marshaller = marshallerClass.newInstance();
        } catch ( InstantiationException e ) {
            throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e);
        } catch ( IllegalAccessException e ) {
            throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e);
        }

        return (T) marshaller.unmarshall(getter.getReturnType(), value.getS());
    }