Top Description Fields Constructors Methods
org.apache.derby.impl.drda

public Class ProtocolTestAdapter

extends Object
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.net.Socket, java.util.Iterator, .Map

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

Modifier and TypeField and Description
private final CcsidManager
public static final int
public static final int
public static final int
private static final CodePointNameTable
CP_NAMES

Shared code point name table (write once, then only reads/lookups).

public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
private final OutputStream
private final DDMReader
private final Socket
public static final byte
private final DDMWriter

Constructor Summary

AccessConstructor and Description
public
ProtocolTestAdapter(Socket
The socket
socket
)

Initializes the adapter for use with the given socket.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Closes the resources associated with the adapter.

public byte[]

Returns:

a byte array according to the CCSID manager.
convertFromJavaString
(String
String to convert
str
)

Converts a string to a byte array according to the CCSID manager.

public Integer

Returns:

The code point identifier, or null if the code point name is unknown.
decodeCodePoint
(String
the name of the code point to look up
codePointName
)

Returns the code point id for the given code point name.

public String

Returns:

Code point name, or null if code point is unknown.
lookupCodePoint
(int
code point to look up
codePoint
)

Returns the name of the given code point.

public boolean
public boolean
public boolean
public byte
public byte[]
public int
public int
public int
public void
public String
rReadString(int length, String enc)

public void
public void
public void
public void
setUtf8Ccsid()

Instructs the DDMReader and DDMWriter to use UTF-8.

public void
public void
public void
public void
public void
public void
public void
wEndDss(byte b)

public void
public void
wPadBytes(byte ch, int len)

private static IOException
wrap(DRDAProtocolException dpe)

Wraps a protocol exception in a generic I/O exception, since DRDAProtocolException is package private.

public void
wStartDdm(int cp)

public void
wWriteByte(int b)

public void
wWriteBytes(byte[] buf)

public void
wWriteCodePoint4Bytes(int cp, int v)

public void
wWriteInt(int v)

public void
wWriteScalar1Byte(int cp, int value)

public void
wWriteScalar2Bytes(int cp, int value)

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

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

public void
public void
wWriteShort(int v)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ccsidManagerback to summary
private final CcsidManager ccsidManager
CP_CODPNTback to summary
public static final int CP_CODPNT
CP_MGRLVLLSback to summary
public static final int CP_MGRLVLLS
CP_MGRLVLRMback to summary
public static final int CP_MGRLVLRM
CP_NAMESback to summary
private static final CodePointNameTable CP_NAMES

Shared code point name table (write once, then only reads/lookups).

CP_PRCCNVCDback to summary
public static final int CP_PRCCNVCD
CP_PRCCNVRMback to summary
public static final int CP_PRCCNVRM
CP_SECCHKCDback to summary
public static final int CP_SECCHKCD
CP_SECMECback to summary
public static final int CP_SECMEC
CP_SQLCARDback to summary
public static final int CP_SQLCARD
CP_SVRCODback to summary
public static final int CP_SVRCOD
CP_SYNERRCDback to summary
public static final int CP_SYNERRCD
CP_SYNTAXRMback to summary
public static final int CP_SYNTAXRM
outback to summary
private final OutputStream out
readerback to summary
private final DDMReader reader
socketback to summary
private final Socket socket
SPACEback to summary
public static final byte SPACE
writerback to summary
private final DDMWriter writer

Constructor Detail

ProtocolTestAdapterback to summary
public ProtocolTestAdapter(Socket socket) throws IOException

Initializes the adapter for use with the given socket.

Parameters
socket:Socket

The socket

Exceptions
IOException:
on error

Method Detail

closeback to summary
public void close() throws IOException

Closes the resources associated with the adapter.

Exceptions
IOException:
on error
convertFromJavaStringback to summary
public byte[] convertFromJavaString(String str)

Converts a string to a byte array according to the CCSID manager.

Parameters
str:String

String to convert

Returns:byte[]

a byte array according to the CCSID manager.

decodeCodePointback to summary
public Integer decodeCodePoint(String codePointName)

Returns the code point id for the given code point name.

Parameters
codePointName:String

the name of the code point to look up

Returns:Integer

The code point identifier, or null if the code point name is unknown.

lookupCodePointback to summary
public String lookupCodePoint(int codePoint)

Returns the name of the given code point.

Parameters
codePoint:int

code point to look up

Returns:String

Code point name, or null if code point is unknown.

rMoreDataback to summary
public boolean rMoreData()
rMoreDdmDataback to summary
public boolean rMoreDdmData()
rMoreDssDataback to summary
public boolean rMoreDssData()
rReadByteback to summary
public byte rReadByte() throws IOException
rReadBytesback to summary
public byte[] rReadBytes() throws IOException
rReadLengthAndCodePointback to summary
public int rReadLengthAndCodePoint(boolean f) throws IOException
rReadNetworkIntback to summary
public int rReadNetworkInt() throws IOException
rReadNetworkShortback to summary
public int rReadNetworkShort() throws IOException
rReadReplyDssback to summary
public void rReadReplyDss() throws IOException
rReadStringback to summary
public String rReadString(int length, String enc) throws IOException
rSkipBytesback to summary
public void rSkipBytes() throws IOException
rSkipDdmback to summary
public void rSkipDdm() throws IOException
rSkipDssback to summary
public void rSkipDss() throws IOException
setUtf8Ccsidback to summary
public void setUtf8Ccsid()

Instructs the DDMReader and DDMWriter to use UTF-8.

wCreateDssObjectback to summary
public void wCreateDssObject()
wCreateDssReplyback to summary
public void wCreateDssReply()
wCreateDssRequestback to summary
public void wCreateDssRequest()
wEndDdmback to summary
public void wEndDdm()
wEndDdmAndDssback to summary
public void wEndDdmAndDss()
wEndDssback to summary
public void wEndDss()
wEndDssback to summary
public void wEndDss(byte b)
wFlushback to summary
public void wFlush() throws IOException
wPadBytesback to summary
public void wPadBytes(byte ch, int len)
wrapback to summary
private static IOException wrap(DRDAProtocolException dpe)

Wraps a protocol exception in a generic I/O exception, since DRDAProtocolException is package private.

wStartDdmback to summary
public void wStartDdm(int cp)
wWriteByteback to summary
public void wWriteByte(int b)
wWriteBytesback to summary
public void wWriteBytes(byte[] buf)
wWriteCodePoint4Bytesback to summary
public void wWriteCodePoint4Bytes(int cp, int v)
wWriteIntback to summary
public void wWriteInt(int v)
wWriteScalar1Byteback to summary
public void wWriteScalar1Byte(int cp, int value)
wWriteScalar2Bytesback to summary
public void wWriteScalar2Bytes(int cp, int value)
wWriteScalarBytesback to summary
public void wWriteScalarBytes(int cp, byte[] buf)
wWriteScalarPaddedBytesback to summary
public void wWriteScalarPaddedBytes(int cp, byte[] buf, int length, byte ch)
wWriteScalarStringback to summary
public void wWriteScalarString(int cp, String str)
wWriteShortback to summary
public void wWriteShort(int v)