Skip to content

Instantly share code, notes, and snippets.

@XiaoPangxie732
Last active April 16, 2022 19:33
Show Gist options
  • Save XiaoPangxie732/5805cd7926941b3b1d5c8efc1bd80264 to your computer and use it in GitHub Desktop.
Save XiaoPangxie732/5805cd7926941b3b1d5c8efc1bd80264 to your computer and use it in GitHub Desktop.
things may be useful
public static byte[] readFileUsingFileChannelAndMappedByteBuffer(Path file) {
try(FileChannel ch = FileChannel.open(file, StandardOpenOption.READ)) {
MappedByteBuffer mbb = ch.map(FileChannel.MapMode.READ_ONLY, 0, ch.size());
byte[] bytes = new byte[mbb.remaining()];
mbb.get(bytes);
return bytes;
}
}
jvm method descriptor: ^\((\[*([ZBCDFIJS]|L([A-Za-z_]+\w*[/$]?)+;))*\)\[*([ZBCDFIJSV]|L([A-Za-z_]+\w*[/$]?)+;)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment