Windows 10上的领域数据浏览器

Hah*_*pro 9 realm

我设法使用这些代码获取export.realm

package com.meow.meowmeow;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.net.Uri;
import android.util.Log;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import io.realm.Realm;
import io.realm.RealmConfiguration;

/**
 * Created by Thien on 9/1/2015.
 */
public class RealmTool {
    private static String LOG_TAG = "RealmTool";

    //export to email
    public static void exportDatabase(Context context,RealmConfiguration configuration) {

        // init realm
        Realm realm = Realm.getInstance(configuration);

        File exportRealmFile = null;
        try {
            // get or create an "export.realm" file
            exportRealmFile = new File(context.getExternalCacheDir(), "export.realm");

            // if "export.realm" already exists, delete
            exportRealmFile.delete();

            // copy current realm to "export.realm"
            realm.writeCopyTo(exportRealmFile);


        } catch (IOException e) {
            e.printStackTrace();
        }
        realm.close();

        // init email intent and add export.realm as attachment
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("plain/text");
        intent.putExtra(Intent.EXTRA_EMAIL, "YOUR MAIL");
        intent.putExtra(Intent.EXTRA_SUBJECT, "YOUR SUBJECT");
        intent.putExtra(Intent.EXTRA_TEXT, "YOUR TEXT");
        Uri u = Uri.fromFile(exportRealmFile);
        intent.putExtra(Intent.EXTRA_STREAM, u);

        // start email intent
        context.startActivity(Intent.createChooser(intent, "YOUR CHOOSER TITLE"));
    }

    //import from assets
    public static RealmConfiguration importDatabase(Context context, String realm_file_name){
        RealmConfiguration defaultRealm = new RealmConfiguration.Builder(context).build();
        String dir = defaultRealm.getPath();
        AssetManager assetManager = context.getAssets();
        try {
            InputStream is;
            is = assetManager.open(realm_file_name);
            File dest = new File(dir);
            if (dest.exists())
                dest.delete();
            copy(is,dest);
        }catch (IOException e){
            Log.e(LOG_TAG,"import database error");
        }
        return defaultRealm;
    }

    public static void copy(File src, File dst) throws IOException {
        InputStream in = new FileInputStream(src);
        OutputStream out = new FileOutputStream(dst);

        // Transfer bytes from in to out
        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        }
        in.close();
        out.close();
    }
    public static void copy(InputStream in, File dst) throws IOException {

        OutputStream out = new FileOutputStream(dst);

        // Transfer bytes from in to out
        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        }
        in.close();
        out.close();
    }

}
Run Code Online (Sandbox Code Playgroud)

现在我想看看.如何在Windows中编辑它.开发人员说他们在Mac上只有领域浏览器但是我使用的是Windows 10.所以任何人都有任何方法或任何工具来浏览Windows上的领域.谢谢.

TiM*_*TiM 17

(免责声明:我是负责Realm Browser for Mac的人.:))

我们听到你了!不幸的是,目前,甚至考虑使用Realm Browser for Windows版本,我们需要让Realm本身在Windows上运行才能开始!这是我们绝对努力的事情,但显然这不是一点点工作; 所以我们还没有任何发布时间表.

目前,如果您想从Android应用程序调试Realm文件,实际上有一个非常酷的开源第三方Android Realm浏览器应用程序,您可以使用它:https://github.com/dmytrodanylyk/realm -browser

对不起,我无法带来更好的消息,但至少,我希望在此期间有所帮助.但我们100%意识到在Windows上拥有相同版本的Realm Browser将极大地帮助在该平台上进行Android开发.