Créer un ByteArrayInputStream à partir d'un MappedByteBuffer
Bonjour,
j'ai une java.lang.UnsupportedOperationException que je ne comprend pas en essayant de créer un ByteArrayInputStream à partir d'un MappedByteBuffer.
Quelqu'un pourrait-il m'aider ?
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
RandomAccessFile raf = new RandomAccessFile(this.file, "r");
FileChannel channel = raf.getChannel();
MappedByteBuffer mpb = null;
try {
mpb = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
} catch (IOException ex) {
ex.printStackTrace();
}
// Ligne à laquelle à lieu l'exception
this.fileInputStream = new ByteArrayInputStream(mpb.array()); |
Merci d'avance.