Class PR


  • public class PR
    extends java.lang.Object
    This class provides static access to raw NSPS calls with the PR prefix, and handles the usage of NativeProxy objects.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int FAILURE
      Return value on failure from NSPR functions.
      static int SHUTDOWN_BOTH
      Shut down both sides of the TCP connection.
      static int SHUTDOWN_RCV
      Shut down the receiving side of the TCP connection.
      static int SHUTDOWN_SEND
      Shut down the sending side of the TCP connection.
      static int SUCCESS
      Return value on success from NSPR functions.
    • Constructor Summary

      Constructors 
      Constructor Description
      PR()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int Close​(PRFDProxy fd)
      Close an existing PRFDProxy.
      static java.lang.String ErrorToName​(int code)
      Get the constant name of the current PR error.
      static int GetError()
      Get the value of the current PR error.
      static java.lang.String GetErrorText()
      Get the error text of the current PR error.
      static PRFDProxy NewBufferPRFD​(BufferProxy read_buf, BufferProxy write_buf, byte[] peer_info)
      Create a new j_buffer backed PRFileDesc, mimicing a TCP socket with the specified peer_info.
      static PRFDProxy NewTCPSocket()
      Open a new TCP Socket and create a new PRFDProxy for that socket.
      static PRFDProxy Open​(java.lang.String name, int flags, int mode)
      Open the file at name (with the specified flags and mode) and create a new PRFDProxy (to a NSPR PRFileDesc *) for that file.
      static byte[] Read​(PRFDProxy fd, int amount)
      Read up to amount bytes from a PRFDProxy.
      static byte[] Recv​(PRFDProxy fd, int amount, int flags, long timeout)
      Recv up to amount bytes from a PRFDProxy, given the specified receive flags and timeout value.
      static int Send​(PRFDProxy fd, byte[] buf, int flags, long timeout)
      Send the specified bytes via the PRFDProxy, given the specified send flags and timeout value.
      static int Shutdown​(PRFDProxy fd, int how)
      Shutdown an existing PRFDProxy.
      static int Write​(PRFDProxy fd, byte[] buf)
      Write the specified bytes to the PRFDProxy.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SHUTDOWN_RCV

        public static final int SHUTDOWN_RCV
        Shut down the receiving side of the TCP connection. See also: Shutdown
      • SHUTDOWN_SEND

        public static final int SHUTDOWN_SEND
        Shut down the sending side of the TCP connection. See also: Shutdown
      • SHUTDOWN_BOTH

        public static final int SHUTDOWN_BOTH
        Shut down both sides of the TCP connection. See also: Shutdown
      • SUCCESS

        public static final int SUCCESS
        Return value on success from NSPR functions. See also: PR_SUCCESS in /usr/include/nspr4/prtypes.h
      • FAILURE

        public static final int FAILURE
        Return value on failure from NSPR functions. See also: PR_FAILURE in /usr/include/nspr4/prtypes.h
    • Constructor Detail

      • PR

        public PR()
    • Method Detail

      • Open

        public static PRFDProxy Open​(java.lang.String name,
                                     int flags,
                                     int mode)
        Open the file at name (with the specified flags and mode) and create a new PRFDProxy (to a NSPR PRFileDesc *) for that file. See also: PR_Open in /usr/include/nspr4/prio.h
      • NewTCPSocket

        public static PRFDProxy NewTCPSocket()
        Open a new TCP Socket and create a new PRFDProxy for that socket. See also: PR_NewTCPSocket in /usr/include/nspr4/prio.h
      • NewBufferPRFD

        public static PRFDProxy NewBufferPRFD​(BufferProxy read_buf,
                                              BufferProxy write_buf,
                                              byte[] peer_info)
        Create a new j_buffer backed PRFileDesc, mimicing a TCP socket with the specified peer_info. See also: newBufferPRFileDesc in org/mozilla/jss/ssl/javax/BufferPRFD.h
      • Close

        public static int Close​(PRFDProxy fd)
        Close an existing PRFDProxy. See also: PR_Close in /usr/include/nspr4/prio.h
      • Shutdown

        public static int Shutdown​(PRFDProxy fd,
                                   int how)
        Shutdown an existing PRFDProxy. This is usually used with TCP modes. See also: PR_Shutdown in /usr/include/nspr4/prio.h
      • Read

        public static byte[] Read​(PRFDProxy fd,
                                  int amount)
        Read up to amount bytes from a PRFDProxy. See also: PR_Read in /usr/include/nspr4/prio.h
      • Recv

        public static byte[] Recv​(PRFDProxy fd,
                                  int amount,
                                  int flags,
                                  long timeout)
        Recv up to amount bytes from a PRFDProxy, given the specified receive flags and timeout value. See also: PR_Recv in /usr/include/nspr4/prio.h
      • Write

        public static int Write​(PRFDProxy fd,
                                byte[] buf)
        Write the specified bytes to the PRFDProxy. Note: Unlike PR_Write, this method assumes the entire buffer is being written. See also: PR_Write in /usr/include/nspr4/prio.h
      • Send

        public static int Send​(PRFDProxy fd,
                               byte[] buf,
                               int flags,
                               long timeout)
        Send the specified bytes via the PRFDProxy, given the specified send flags and timeout value. See also: PR_Send in /usr/include/nspr4/prio.h
      • GetError

        public static int GetError()
        Get the value of the current PR error. This is cleared on each NSPR call. See also: PR_GetError in /usr/include/nspr4/prio.h
      • GetErrorText

        public static java.lang.String GetErrorText()
        Get the error text of the current PR error. This is cleared on each NSPR call. See also: PR_GetErrorText in /usr/include/nspr4/prio.h
      • ErrorToName

        public static java.lang.String ErrorToName​(int code)
        Get the constant name of the current PR error. This is cleared on each NSPR call. See also: PR_ErrorToName in /usr/include/nspr4/prio.h