uCosminexus Service Platform, Basic Development Guide
Reading information interface is as follows:
Create the implementation class of following interface, when developing character code conversion UOC.
Figure I-5 FigureCSCOwnCodeReaderContext implementation class
package jp.co.Hitachi.soft.csc.dt.uoc ; public interface CSCOwnCodeReaderContext { int getPosition() ; int getLength() ; boolean canSeparate() ; }
Method name | Description |
---|---|
getPosition method | This method returns the current character position or size of data to be read. |
getLength method | This method returns the current character length. |
canSeparate method | This method returns whether to consider the current character as the separator parsing target. |
When data transformation target is variable length character string and separator has been set in the binary format definition, data transformation executes the separator parsing process. Following figure shows the order of invoking each method of CSCOwnCodeReader and CSCOwnCodeReaderContext.
Figure I-6 FigureOrder of invoking each method of CSCOwnCodeReader and CSCOwnCodeReaderContext
public int getPosition()
public int getLength()
public boolean canSeparate()
Exception class that occurs at the time of developing character code conversion UOC is as follows:
Implementation example (MS932) of CSCOwnCodeReaderContext interface is as follows:
public class CSCOwnCodeReaderContextImpl implements CSCOwnCodeReaderContext { private final byte[] data ; private int position = 0 ; private int next = 0 ; private int length = 0 ; public CSCOwnCodeReaderContextImpl( final byte[] data ) { this.data = data ; } @Override public int getPosition() { return position ; } @Override public int getLength() { return length ; } @Override public boolean canSeparate() { // MS932 does not have shift (escape sequence) status and // no limitation for occurrence of separator. Hence, always returns true return true ; } public byte[] getData() { return data ; } public void setPosition( int position ) { this.position = position ; } public void setLength( int length ) { this.length = length ; } public int getNextPosition() { return this.next ; } public void setNextPosition( int position ) { this.next = position ; } }
Implementation example (IBM Kanji code) of CSCOwnCodeReaderContext interface is as follows:
public class CSCOwnCodeReaderContextImpl implements CSCOwnCodeReaderContext { private final byte[] data ; private int position = 0 ; private int length = 1 ; private int next = 0 ; private boolean canSeparate = true ; public CSCOwnCodeReaderContextImpl( final byte[] data ) { this.data = data ; } @Override public int getPosition() { return position ; } @Override public int getLength() { return length ; } @Override public boolean canSeparate() { return canSeparate ; } public byte[] getData() { return data ; } public void setPosition( int position ) { this.position = position ; } public void setLength( int length ) { this.length = length ; } public void setCanSeparate( boolean canSeparate ) { this.canSeparate = canSeparate ; } public int getNextPosition() { return this.next ; } public void setNextPosition( int position ) { this.next = position ; } }
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.