Creates a AiffData container from the specified bytes

@param buffer array of bytes containing the complete Aiff file
@return AiffData containing data, or null if a failure occured
171970
public static AiffData create(byte[] buffer) {
		try {
			return create(
				AudioSystem.getAudioInputStream(
					new BufferedInputStream(new ByteArrayInputStream(buffer))));
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
812305
public static ByteBuf wrappedBuffer(byte[] array, int offset, int length) {
        if (length == 0) {
            return EMPTY_BUFFER;
        }

        if (offset == 0 && length == array.length) {
            return wrappedBuffer(array);
        }

        return wrappedBuffer(array).slice(offset, length);
    }
1212915
synchronized public int encodeIntoByteBuffer(final ByteBuffer buffer) {
        long maxValue = integerValuesHistogram.getMaxValue();
        int relevantLength = integerValuesHistogram.getLengthForNumberOfBuckets(
                integerValuesHistogram.getBucketsNeededToCoverValue(maxValue));
        if (buffer.capacity() < getNeededByteBufferCapacity(relevantLength)) {
            throw new ArrayIndexOutOfBoundsException("buffer does not have capacity for " +
                    getNeededByteBufferCapacity(relevantLength) + " bytes");
        }
        buffer.putInt(DHIST_encodingCookie);
        buffer.putInt(getNumberOfSignificantValueDigits());
        buffer.putLong(configuredHighestToLowestValueRatio);
        return integerValuesHistogram.encodeIntoByteBuffer(buffer) + 16;
    }
139795
public static byte[] fromHexByteArray(final byte[] buffer)
    {
        final byte[] outputBuffer = new byte[buffer.length >> 1];

        for (int i = 0; i < buffer.length; i += 2)
        {
            final int hi = FROM_HEX_DIGIT_TABLE[buffer[i]] << 4;
            final int lo = FROM_HEX_DIGIT_TABLE[buffer[i + 1]]; // lgtm [java/index-out-of-bounds]
            outputBuffer[i >> 1] = (byte)(hi | lo);
        }

        return outputBuffer;
    }
1238111
public byte[] ensureBufferHasCapacityLeft(int size) throws FileParsingException {
    if (bytesHolder == null) {
      bytesHolder = new ByteArrayHolder(size);
    } else {
      bytesHolder.ensureHasSpace(size);
    }
    return bytesHolder.getUnderlyingBytes();
  }
190310
function toArrayBuffer(buf) {
  if (buf.byteLength === buf.buffer.byteLength) {
    return buf.buffer;
  }

  return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
}
715718
protected static byte[] getData(byte[] data, int size) {
        if (data == null) {
            return NO_DATA;
        }
        if (data.length <= size) {
            return data;
        }
        byte[] newData = new byte[size];
        System.arraycopy(data, 0, newData, 0, size);
        return newData;
    }
720133
@Override
    public DataBuffer createHalf(long offset, byte[] data, int length) {
        return new CudaHalfDataBuffer(ArrayUtil.toFloatArray(data), true, offset);
    }
681158
public static BinaryInMemorySortBuffer createBuffer(
			NormalizedKeyComputer normalizedKeyComputer,
			AbstractRowSerializer<BaseRow> inputSerializer,
			BinaryRowSerializer serializer,
			RecordComparator comparator,
			List<MemorySegment> memory) throws IOException {
		checkArgument(memory.size() >= MIN_REQUIRED_BUFFERS);
		int totalNumBuffers = memory.size();
		ListMemorySegmentPool pool = new ListMemorySegmentPool(memory);
		ArrayList<MemorySegment> recordBufferSegments = new ArrayList<>(16);
		return new BinaryInMemorySortBuffer(
				normalizedKeyComputer, inputSerializer, serializer, comparator, recordBufferSegments,
				new SimpleCollectingOutputView(recordBufferSegments, pool, pool.pageSize()),
				pool, totalNumBuffers);
	}
179206
@Override
	public void getImageBytes(ByteBuffer buffer) {
		final BufferedImage bi = getImage();
		if (bi != null) {
			buffer.put(ImageUtils.imageToBytes(bi));
		}
	}
467781
@SuppressWarnings("unchecked")
    public BaseBo fromByteArray(byte[] data) {
        Map<String, Object> dataMap = null;
        try {
            dataMap = data != null ? SerializationUtils.fromByteArray(data, Map.class) : null;
        } catch (Exception e) {
            dataMap = null;
        }
        return fromMap(dataMap);
    }
361824
@Nullable
  public static InputStream getMappedInputStream (@Nonnull final File aFile)
  {
    ValueEnforcer.notNull (aFile, "File");

    // Open regular
    final FileInputStream aFIS = FileHelper.getInputStream (aFile);
    if (aFIS == null)
      return null;

    // Try to memory map it
    final InputStream aIS = _getMappedInputStream (aFIS.getChannel (), aFile);
    if (aIS != null)
      return aIS;

    // Memory mapping failed - return the original input stream
    if (LOGGER.isWarnEnabled ())
      LOGGER.warn ("Failed to map file " + aFile + ". Falling though to regular FileInputStream");
    return aFIS;
  }
399797
function toArrayBuffer(buffer) {
    var length = buffer.length;
    var view = new DataView(new ArrayBuffer(length), 0, length);
    for (var i = 0, l = length; i < l; i++) {
        view.setUint8(i, buffer[i], false);
    }
    return view.buffer;
}
997718
public static byte[] readBytesFromFile(File f) {
        byte[] bytes = null;
        try {
            int filesize = (int) f.length();
            bytes = new byte[filesize];
            DataInputStream in = new DataInputStream(new FileInputStream(f));
            in.readFully(bytes);
            in.close();
        } catch (Exception e) {
            System.out.println("Error reading byte[] from file: "
                    + e.getMessage());
            return null;
        }
        return bytes;
    }
487842
private static byte[] toByteArray(final ByteBuffer buffer)
  {
    if (buffer.hasArray()
        && buffer.arrayOffset() == 0
        && buffer.position() == 0
        && buffer.array().length == buffer.limit()) {
      return buffer.array();
    } else {
      final byte[] retVal = new byte[buffer.remaining()];
      buffer.duplicate().get(retVal);
      return retVal;
    }
  }
90985
public static ByteArrayInputStream toStream(ByteBuffer byteBuffer) {
        if (byteBuffer == null) {
            return new ByteArrayInputStream(new byte[0]);
        }
        return new ByteArrayInputStream(copyBytesFrom(byteBuffer));
    }
1287573
@Override
    public DataBuffer createHalf(long offset, byte[] data, boolean copy) {
        return new CudaHalfDataBuffer(ArrayUtil.toFloatArray(data), copy, offset);
    }