我有一个方法如下,它已经正常运行了很长时间:
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) 我正在尝试使用 npm 为我的 React Native 应用程序安装 Realm。但是,我没能成功。
我的环境/设置是:
我一直在尝试使用这个命令:
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)