小编gar*_*ong的帖子

线程“main”中的异常 java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer

我有一个方法如下,它已经正常运行了很长时间:

private String loadFromFile(){

    RandomAccessFile inFile = null;
    FileChannel inChannel = null;
    StringBuilder sb = new StringBuilder();
    try {

        inFile = new RandomAccessFile(this.latestImageFile, "r");
        inChannel = inFile.getChannel();

        ByteBuffer bb = ByteBuffer.allocate(2046);
        while( inChannel.read(bb) != -1){
            bb.flip();

            while(bb.hasRemaining()){
                char c = (char) bb.get();   // read character at current position and set the pointer to current position + 1
                sb.append(c);
            }

            bb.clear();
        }

    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        if (inChannel != null) try {inChannel.close(); } catch (IOException e){} …
Run Code Online (Sandbox Code Playgroud)

java bytebuffer java-8 java-11

29
推荐指数
1
解决办法
1万
查看次数

无法在我的 ReactNative 应用程序上安装 Realm;与: npm 错误!在realm@3.6.0 安装脚本'node-pre-gyp install --fallback-to-build' 失败

我正在尝试使用 npm 为我的 React Native 应用程序安装 Realm。但是,我没能成功。

我的环境/设置是:

  • 视窗 10
  • Node.js v12.13.0
  • npm v6.13.0

我一直在尝试使用这个命令:
npm install --save realm

或指定版本号:
npm install --save realm@3.6.0

但根本没有运气。以下错误消息总是提示没有明确提示给我:

> realm@3.6.0 install C:\Projects\<ProjectFolder>\node_modules\realm
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://static.realm.io/node-pre-gyp/3.6.0/realm-v3.6.0-node-v72-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for realm@3.6.0 and node@12.13.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command …
Run Code Online (Sandbox Code Playgroud)

realm node.js npm react-native

3
推荐指数
1
解决办法
2674
查看次数

标签 统计

bytebuffer ×1

java ×1

java-11 ×1

java-8 ×1

node.js ×1

npm ×1

react-native ×1

realm ×1