Package org.apache.derby.impl.drda
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 CcsidManager
static final int
static final int
static final int
private static final CodePointNameTable
Shared code point name table (write once, then only reads/lookups).static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
private final OutputStream
private final DDMReader
private final Socket
static final byte
private final DDMWriter
-
Constructor Summary
ConstructorsConstructorDescriptionProtocolTestAdapter
(Socket socket) Initializes the adapter for use with the given socket. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
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.boolean
boolean
boolean
byte
byte[]
int
rReadLengthAndCodePoint
(boolean f) int
int
void
rReadString
(int length, String enc) void
void
rSkipDdm()
void
rSkipDss()
void
Instructs theDDMReader
andDDMWriter
to use UTF-8.void
void
void
void
wEndDdm()
void
void
wEndDss()
void
wEndDss
(byte b) void
wFlush()
void
wPadBytes
(byte ch, int len) private static IOException
Wraps a protocol exception in a generic I/O exception, sinceDRDAProtocolException
is package private.void
wStartDdm
(int cp) void
wWriteByte
(int b) void
wWriteBytes
(byte[] buf) void
wWriteCodePoint4Bytes
(int cp, int v) void
wWriteInt
(int v) void
wWriteScalar1Byte
(int cp, int value) void
wWriteScalar2Bytes
(int cp, int value) void
wWriteScalarBytes
(int cp, byte[] buf) void
wWriteScalarPaddedBytes
(int cp, byte[] buf, int length, byte ch) void
wWriteScalarString
(int cp, String str) void
wWriteShort
(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
null
if code point is unknown.
-
decodeCodePoint
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
Converts a string to a byte array according to the CCSID manager. -
setUtf8Ccsid
public void setUtf8Ccsid()Instructs theDDMReader
andDDMWriter
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
-
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, sinceDRDAProtocolException
is package private.
-