Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangBinary


  public BeamFileData load(byte[] data) throws IOException {

    sendGEN(conn, "beam_loader", new OtpErlangTuple(
        new OtpErlangObject[] {
              new OtpErlangAtom("disasm"),
              new OtpErlangBinary(data) }));

    try {
      OtpErlangObject reply = conn.receiveRPC();

      return new SymbolicBeamFileData(check((ETuple)OtpConverter.convert(reply), data));
View Full Code Here


        final OtpErlangAtom level = (OtpErlangAtom) t.elementAt(2);
        final OtpErlangObject logEvent = t.elementAt(3);
        String ss = "";
        if (t.arity() == 5) {
            final OtpErlangTuple backtrace_0 = (OtpErlangTuple) t.elementAt(4);
            final OtpErlangBinary backtrace = (OtpErlangBinary) backtrace_0.elementAt(1);
            ss = new String(backtrace.binaryValue());
        }
        try {
            ErlLogger.getInstance().erlangLog(module.atomValue() + ".erl",
                    line.uIntValue(), level.atomValue().toUpperCase(), "%s %s",
                    logEvent.toString(), ss);
View Full Code Here

        final OtpErlangTuple t1 = (OtpErlangTuple) r1;

        List<ErlToken> toks = null;
        if (Util.isOk(t1)) {
            if (t1.elementAt(1) instanceof OtpErlangBinary) {
                final OtpErlangBinary b = (OtpErlangBinary) t1.elementAt(1);
                final byte[] bytes = b.binaryValue();
                toks = new ArrayList<ErlToken>(bytes.length / 10);
                for (int i = 0; i < bytes.length; i += 10) {
                    final ErlToken tk = new ErlToken(bytes, i, offset);
                    toks.add(tk);
                }
View Full Code Here

        test("", "s", new OtpErlangString(""));
    }

    @Test
    public void cvtStringOk_3() throws SignatureException {
        test("astring", "b", new OtpErlangBinary("astring".getBytes()));
    }
View Full Code Here

        Assert.assertEquals(expected, actual);
    }

    @Test
    public void stringValue_4() {
        final OtpErlangObject input = new OtpErlangBinary(new byte[] { 51, 52, 53 });
        final String expected = "345";
        final String actual = Util.stringValue(input);
        Assert.assertEquals(expected, actual);
    }
View Full Code Here

    }

    @Test
    public void stringValue_5() {
        final byte[] bytes = new byte[] { 197 - 256, 246 - 256 };
        final OtpErlangObject input = new OtpErlangBinary(bytes);
        final byte[] expected = bytes;
        final String actual = Util.stringValue(input);
        assertThat(actual.getBytes(Charsets.ISO_8859_1), is(expected));
    }
View Full Code Here

    }

    @Test
    public void stringValue_6() {
        final byte[] bytes = new byte[] { (byte) 0xE8, (byte) 0x8F, (byte) 0xAF };
        final OtpErlangObject input = new OtpErlangBinary(bytes);
        final byte[] expected = bytes;
        final String actual = Util.stringValue(input);
        assertThat(actual.getBytes(Charsets.UTF_8), is(expected));
    }
View Full Code Here

            final FileInputStream stream) {
        try {
            final int sz = (int) stream.getChannel().size();
            final byte[] buf = new byte[sz];
            stream.read(buf);
            return new OtpErlangBinary(buf);
        } catch (final IOException e) {
            ErlLogger.warn(e);
            return null;
        }
    }
View Full Code Here

                if (path.getFileExtension() != null
                        && "beam".compareTo(path.getFileExtension()) == 0) {
                    final String m = path.removeFileExtension().lastSegment();
                    try {
                        boolean ok = false;
                        final OtpErlangBinary bin = BeamUtil.getBeamBinary(m, path);
                        if (bin != null) {
                            ok = BeamLoader.loadBeam(getOtpRpc(), m, bin);
                        }
                        if (!ok) {
                            ErlLogger.error("Could not load %s", m);
View Full Code Here

        ErlLogger.debug("unloading %s for %s", bundle.getBundle(), backendName);
        unloadCodeForBundle(context, bundle);
    }

    private boolean loadBeam(final String moduleName, final URL beamPath) {
        final OtpErlangBinary bin = BeamUtil.getBeamBinary(moduleName, beamPath);
        if (bin == null) {
            return false;
        }
        return BeamLoader.loadBeam(site, moduleName, bin);
    }
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangBinary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.