Class ProtocolTestAdapter
java.lang.Object
org.apache.derby.impl.drda.ProtocolTestAdapter
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final CcsidManagerstatic final intstatic final intstatic final intprivate static final CodePointNameTableShared code point name table (write once, then only reads/lookups).static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprivate final OutputStreamprivate final DDMReaderprivate final Socketstatic final byteprivate final DDMWriter -
Constructor Summary
ConstructorsConstructorDescriptionProtocolTestAdapter(Socket socket) Initializes the adapter for use with the given socket. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the resources associated with the adapter.byte[]Converts a string to a byte array according to the CCSID manager.decodeCodePoint(String codePointName) Returns the code point id for the given code point name.lookupCodePoint(int codePoint) Returns the name of the given code point.booleanbooleanbooleanbytebyte[]intrReadLengthAndCodePoint(boolean f) intintvoidrReadString(int length, String enc) voidvoidrSkipDdm()voidrSkipDss()voidInstructs theDDMReaderandDDMWriterto use UTF-8.voidvoidvoidvoidwEndDdm()voidvoidwEndDss()voidwEndDss(byte b) voidwFlush()voidwPadBytes(byte ch, int len) private static IOExceptionWraps a protocol exception in a generic I/O exception, sinceDRDAProtocolExceptionis package private.voidwStartDdm(int cp) voidwWriteByte(int b) voidwWriteBytes(byte[] buf) voidwWriteCodePoint4Bytes(int cp, int v) voidwWriteInt(int v) voidwWriteScalar1Byte(int cp, int value) voidwWriteScalar2Bytes(int cp, int value) voidwWriteScalarBytes(int cp, byte[] buf) voidwWriteScalarPaddedBytes(int cp, byte[] buf, int length, byte ch) voidwWriteScalarString(int cp, String str) voidwWriteShort(int v)
-
Field Details
-
SPACE
public static final byte SPACE -
CP_SQLCARD
public static final int CP_SQLCARD- See Also:
-
CP_SVRCOD
public static final int CP_SVRCOD- See Also:
-
CP_CODPNT
public static final int CP_CODPNT- See Also:
-
CP_PRCCNVCD
public static final int CP_PRCCNVCD- See Also:
-
CP_SYNERRCD
public static final int CP_SYNERRCD- See Also:
-
CP_MGRLVLLS
public static final int CP_MGRLVLLS- See Also:
-
CP_PRCCNVRM
public static final int CP_PRCCNVRM- See Also:
-
CP_SYNTAXRM
public static final int CP_SYNTAXRM- See Also:
-
CP_MGRLVLRM
public static final int CP_MGRLVLRM- See Also:
-
CP_SECMEC
public static final int CP_SECMEC- See Also:
-
CP_SECCHKCD
public static final int CP_SECCHKCD- See Also:
-
CP_NAMES
Shared code point name table (write once, then only reads/lookups). -
ccsidManager
-
writer
-
socket
-
reader
-
out
-
-
Constructor Details
-
ProtocolTestAdapter
Initializes the adapter for use with the given socket.- Throws:
IOException
-
-
Method Details
-
close
Closes the resources associated with the adapter.- Throws:
IOException
-
lookupCodePoint
Returns the name of the given code point.- Parameters:
codePoint- code point to look up- Returns:
- Code point name, or
nullif code point is unknown.
-
decodeCodePoint
-
convertFromJavaString
Converts a string to a byte array according to the CCSID manager. -
setUtf8Ccsid
public void setUtf8Ccsid()Instructs theDDMReaderandDDMWriterto 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
-
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
- Throws:
IOException
-
rReadReplyDss
- Throws:
IOException
-
rSkipDss
- Throws:
IOException
-
rSkipDdm
- Throws:
IOException
-
rSkipBytes
- Throws:
IOException
-
rMoreData
public boolean rMoreData() -
rMoreDssData
public boolean rMoreDssData() -
rMoreDdmData
public boolean rMoreDdmData() -
rReadNetworkShort
- Throws:
IOException
-
rReadByte
- Throws:
IOException
-
rReadBytes
- Throws:
IOException
-
rReadLengthAndCodePoint
- Throws:
IOException
-
rReadNetworkInt
- Throws:
IOException
-
rReadString
- Throws:
IOException
-
wrap
Wraps a protocol exception in a generic I/O exception, sinceDRDAProtocolExceptionis package private.
-