private static byte[] readBytesFromFileInputStream(FileInputStream fis) throws IOException
    {
        FileChannel channel = fis.getChannel();
        int fileSize = (int) channel.size();
        ByteBuffer byteBuffer = ByteBuffer.allocate(fileSize);
        channel.read(byteBuffer);
        ((Buffer) byteBuffer).flip();    //source    byteBuffer.flip(); 
        byte[] bytes = byteBuffer.array();
        ((Buffer) byteBuffer).clear();        //source    byteBuffer.clear(); 
        channel.close();
        fis.close();
        return bytes;
    }

hanlp.corpus.ioIOUtil.readBytesFromFileInputStream() 定位错误

 

借鉴:

https://stackoverflow.com/questions/61267495/exception-in-thread-main-java-lang-nosuchmethoderror-java-nio-bytebuffer-flip

相关文章:

  • 2021-11-19
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2021-05-02
猜你喜欢
  • 2021-07-19
  • 2021-08-25
  • 2021-07-24
  • 2021-07-09
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
相关资源
相似解决方案