Package com.sun.jna.ptr

Examples of com.sun.jna.ptr.IntByReference


    }
    @JRubyMethod
    public IRubyObject path(ThreadContext context) throws Exception {
        if(openFile.getPath() == null) {
            LibCSocket.sockaddr_un addr = new LibCSocket.sockaddr_un();
            IntByReference len = new IntByReference(LibCSocket.sockaddr_un.LENGTH);
            if(INSTANCE.getsockname(fd, addr, len) < 0) {
                rb_sys_fail(context.getRuntime(), null);
            }
            openFile.setPath(unixpath(addr, len));
        }
View Full Code Here


        return addr(getRuntime().getCurrentContext());
    }
    @JRubyMethod
    public IRubyObject addr(ThreadContext context) throws Exception {
        LibCSocket.sockaddr_un addr = new LibCSocket.sockaddr_un();
        IntByReference len = new IntByReference(LibCSocket.sockaddr_un.LENGTH);
        if(INSTANCE.getsockname(fd, addr, len) < 0) {
            rb_sys_fail(context.getRuntime(), "getsockname(2)");
        }
        return unixaddr(context.getRuntime(), addr, len);
    }
View Full Code Here

        return peeraddr(getRuntime().getCurrentContext());
    }
    @JRubyMethod
    public IRubyObject peeraddr(ThreadContext context) throws Exception {
        LibCSocket.sockaddr_un addr = new LibCSocket.sockaddr_un();
        IntByReference len = new IntByReference(LibCSocket.sockaddr_un.LENGTH);
        if(INSTANCE.getpeername(fd, addr, len) < 0) {
            rb_sys_fail(context.getRuntime(), "getpeername(2)");
        }
        return unixaddr(context.getRuntime(), addr, len);
    }
View Full Code Here

    @JRubyMethod(name = "recvfrom", required = 1, optional = 1)
    public IRubyObject recvfrom(ThreadContext context, IRubyObject[] args) throws Exception {
        ByteBuffer str = ByteBuffer.allocateDirect(1024);
        LibCSocket.sockaddr_un buf = new LibCSocket.sockaddr_un();
        IntByReference alen = new IntByReference(LibCSocket.sockaddr_un.LENGTH);

        IRubyObject len, flg;

        int flags;
View Full Code Here

        return accept(getRuntime().getCurrentContext());
    }
    @JRubyMethod
    public IRubyObject accept(ThreadContext context) throws Exception {
        LibCSocket.sockaddr_un from = new LibCSocket.sockaddr_un();
        int fd2 = INSTANCE.accept(fd, from, new IntByReference(LibCSocket.sockaddr_un.LENGTH));
        if(fd2 < 0) {
            rb_sys_fail(context.getRuntime(), null);
        }

        Ruby runtime = context.getRuntime();
View Full Code Here

        return accept_nonblock(getRuntime().getCurrentContext());
    }
    @JRubyMethod
    public IRubyObject accept_nonblock(ThreadContext context) throws Exception {
        LibCSocket.sockaddr_un from = new LibCSocket.sockaddr_un();
        IntByReference fromlen = new IntByReference(LibCSocket.sockaddr_un.LENGTH);
       
        int flags = INSTANCE.fcntl(fd, RubyUNIXSocket.F_GETFL ,0);
        INSTANCE.fcntl(fd, RubyUNIXSocket.F_SETFL, flags | RubyUNIXSocket.O_NONBLOCK);

        int fd2 = INSTANCE.accept(fd, from, new IntByReference(LibCSocket.sockaddr_un.LENGTH));
        if(fd2 < 0) {
            rb_sys_fail(context.getRuntime(), null);
        }

        Ruby runtime = context.getRuntime();
View Full Code Here

            return tmp.slice();
        }
        @Override
        public Pointer getPointer(long offset) {
            if (Platform.getPlatform().longSize() == 32) {
                IntByReference ref = new IntByReference(getInt(offset));
                return ref.getPointer().getPointer(0);
            } else {
                LongByReference ref = new LongByReference(getLong(offset));
                return ref.getPointer().getPointer(0);
            }
        }
View Full Code Here

                    String message = new String(bytes);
                    if(message.length() > 0) {
                        // Get the information about the object that emitted the log statement
                        PointerByReference modulePointer = new PointerByReference();
                        PointerByReference filePointer = new PointerByReference();
                        IntByReference linePointer = new IntByReference();
                        libvlc.libvlc_log_get_context(ctx, modulePointer, filePointer, linePointer);
                        PointerByReference namePointer = new PointerByReference();
                        PointerByReference headerPointer = new PointerByReference();
                        IntByReference idPointer = new IntByReference();
                        libvlc.libvlc_log_get_object(ctx, namePointer, headerPointer, idPointer);
                        String module = getString(modulePointer);
                        String file = getString(filePointer);
                        Integer line = linePointer.getValue();
                        String name = getString(namePointer);
                        String header = getString(headerPointer);
                        Integer id = idPointer.getValue();
                        // ...send the event
                        raiseLogEvent(libvlc_log_level_e.level(level), module, file, line, name, header, id, message);
                    }
                }
                else {
View Full Code Here

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }

    private void dumpStatus() {
        IntByReference pfEnabled = new IntByReference();
        HRESULT hResult = LibDwmApi.INSTANCE.DwmIsCompositionEnabled(pfEnabled);
        System.out.println("DwmIsCompositionEnabled hResult=" + hResult.intValue());
        if(hResult.intValue() == LibDwmApi.S_OK) {
            System.out.println("Desktop composition is " + (pfEnabled.getValue() != 0 ? "enabled" : "disabled"));
        }
    }
View Full Code Here

    @Override
    public Dimension getVideoDimension() {
        Logger.debug("getVideoDimension()");
        if(getVideoOutputs() > 0) {
            IntByReference px = new IntByReference();
            IntByReference py = new IntByReference();
            int result = libvlc.libvlc_video_get_size(mediaPlayerInstance, 0, px, py);
            if(result == 0) {
                return new Dimension(px.getValue(), py.getValue());
            }
            else {
                Logger.warn("Video size is not available");
                return null;
            }
View Full Code Here

TOP

Related Classes of com.sun.jna.ptr.IntByReference

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.