Class ProtocolTestAdapter


  • public class ProtocolTestAdapter
    extends java.lang.Object
    Adapter written to allow for protocol testing from the test package.

    The only purpose of this class is to make certain constants and methods that are package private available outside of this package for testing purposes. See DERBY-2031.

    • Constructor Detail

      • ProtocolTestAdapter

        public ProtocolTestAdapter​(java.net.Socket socket)
                            throws java.io.IOException
        Initializes the adapter for use with the given socket.
        Throws:
        java.io.IOException
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Closes the resources associated with the adapter.
        Throws:
        java.io.IOException
      • lookupCodePoint

        public java.lang.String lookupCodePoint​(int codePoint)
        Returns the name of the given code point.
        Parameters:
        codePoint - code point to look up
        Returns:
        Code point name, or null if code point is unknown.
      • decodeCodePoint

        public java.lang.Integer decodeCodePoint​(java.lang.String codePointName)
        Returns the code point id for the given code point name.
        Parameters:
        codePointName - the name of the code point to look up
        Returns:
        The code point identifier, or null if the code point name is unknown.
      • convertFromJavaString

        public byte[] convertFromJavaString​(java.lang.String str)
        Converts a string to a byte array according to the CCSID manager.
      • setUtf8Ccsid

        public void setUtf8Ccsid()
        Instructs the DDMReader and DDMWriter to use UTF-8.
      • wCreateDssRequest

        public void wCreateDssRequest()
      • wCreateDssObject

        public void wCreateDssObject()
      • wCreateDssReply

        public void wCreateDssReply()
      • wEndDss

        public void wEndDss()
      • wEndDss

        public void wEndDss​(byte b)
      • wEndDdm

        public void wEndDdm()
      • wEndDdmAndDss

        public void wEndDdmAndDss()
      • wStartDdm

        public void wStartDdm​(int cp)
      • wWriteScalarString

        public void wWriteScalarString​(int cp,
                                       java.lang.String str)
      • wWriteScalar2Bytes

        public void wWriteScalar2Bytes​(int cp,
                                       int value)
      • wWriteScalar1Byte

        public void wWriteScalar1Byte​(int cp,
                                      int value)
      • wWriteScalarBytes

        public void wWriteScalarBytes​(int cp,
                                      byte[] buf)
      • wWriteScalarPaddedBytes

        public void wWriteScalarPaddedBytes​(int cp,
                                            byte[] buf,
                                            int length,
                                            byte ch)
      • wWriteByte

        public void wWriteByte​(int b)
      • wWriteBytes

        public void wWriteBytes​(byte[] buf)
      • wWriteShort

        public void wWriteShort​(int v)
      • wWriteInt

        public void wWriteInt​(int v)
      • wWriteCodePoint4Bytes

        public void wWriteCodePoint4Bytes​(int cp,
                                          int v)
      • wPadBytes

        public void wPadBytes​(byte ch,
                              int len)
      • wFlush

        public void wFlush()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • rReadReplyDss

        public void rReadReplyDss()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • rSkipDss

        public void rSkipDss()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • rSkipDdm

        public void rSkipDdm()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • rSkipBytes

        public void rSkipBytes()
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • rMoreData

        public boolean rMoreData()
      • rMoreDssData

        public boolean rMoreDssData()
      • rMoreDdmData

        public boolean rMoreDdmData()
      • rReadNetworkShort

        public int rReadNetworkShort()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • rReadByte

        public byte rReadByte()
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • rReadBytes

        public byte[] rReadBytes()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • rReadLengthAndCodePoint

        public int rReadLengthAndCodePoint​(boolean f)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • rReadNetworkInt

        public int rReadNetworkInt()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • rReadString

        public java.lang.String rReadString​(int length,
                                            java.lang.String enc)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • wrap

        private static java.io.IOException wrap​(DRDAProtocolException dpe)
        Wraps a protocol exception in a generic I/O exception, since DRDAProtocolException is package private.