Class ProtocolTestAdapter

java.lang.Object
org.apache.derby.impl.drda.ProtocolTestAdapter

public class ProtocolTestAdapter extends 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.

  • Field Details

  • Constructor Details

    • ProtocolTestAdapter

      public ProtocolTestAdapter(Socket socket) throws IOException
      Initializes the adapter for use with the given socket.
      Throws:
      IOException
  • Method Details

    • close

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

      public 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 Integer decodeCodePoint(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(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, 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 IOException
      Throws:
      IOException
    • rReadReplyDss

      public void rReadReplyDss() throws IOException
      Throws:
      IOException
    • rSkipDss

      public void rSkipDss() throws IOException
      Throws:
      IOException
    • rSkipDdm

      public void rSkipDdm() throws IOException
      Throws:
      IOException
    • rSkipBytes

      public void rSkipBytes() throws IOException
      Throws:
      IOException
    • rMoreData

      public boolean rMoreData()
    • rMoreDssData

      public boolean rMoreDssData()
    • rMoreDdmData

      public boolean rMoreDdmData()
    • rReadNetworkShort

      public int rReadNetworkShort() throws IOException
      Throws:
      IOException
    • rReadByte

      public byte rReadByte() throws IOException
      Throws:
      IOException
    • rReadBytes

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

      public int rReadLengthAndCodePoint(boolean f) throws IOException
      Throws:
      IOException
    • rReadNetworkInt

      public int rReadNetworkInt() throws IOException
      Throws:
      IOException
    • rReadString

      public String rReadString(int length, String enc) throws IOException
      Throws:
      IOException
    • wrap

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