本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaInterface.isString方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaInterface.isString方法的具体用法?Java ValueMetaInterface.isString怎么用?Java ValueMetaInterface.isString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.row.ValueMetaInterface
的用法示例。
在下文中一共展示了ValueMetaInterface.isString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* Takes an input field and converts it to bytes to be stored in the temp file.
* @param v The metadata about the column
* @param valueData The column data
* @return The bytes for the value
* @throws KettleValueException
*/
private byte[] formatField( ValueMetaInterface v, Object valueData ) throws KettleValueException {
if ( v.isString() ) {
if ( v.isStorageBinaryString() && v.getTrimType() == ValueMetaInterface.TRIM_TYPE_NONE && v.getLength() < 0
&& Const.isEmpty( v.getStringEncoding() ) ) {
return (byte[]) valueData;
} else {
String svalue = ( valueData instanceof String ) ? (String) valueData : v.getString( valueData );
// trim or cut to size if needed.
//
return convertStringToBinaryString( v, Const.trimToType( svalue, v.getTrimType() ) );
}
} else {
return v.getBinaryString( valueData );
}
}
示例2: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private byte[] formatField(ValueMetaInterface v, Object valueData) throws KettleValueException
{
if( v.isString() )
{
if (v.isStorageBinaryString()
&& v.getTrimType()==ValueMetaInterface.TRIM_TYPE_NONE
&& v.getLength()<0
&& Const.isEmpty(v.getStringEncoding())
) {
return (byte[])valueData;
} else {
String svalue = (valueData instanceof String)?(String)valueData:v.getString(valueData);
// trim or cut to size if needed.
//
return convertStringToBinaryString(v,Const.trimToType(svalue, v.getTrimType()));
}
}
else
{
return v.getBinaryString(valueData);
}
}
示例3: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private byte[] formatField(ValueMetaInterface v, Object valueData) throws KettleValueException {
if (v.isString()) {
if (v.isStorageBinaryString() && v.getTrimType() == ValueMetaInterface.TRIM_TYPE_NONE && v.getLength() < 0
&& Const.isEmpty( v.getStringEncoding())) {
return (byte[]) valueData;
} else {
String svalue = (valueData instanceof String) ? (String) valueData : v.getString(valueData);
// trim or cut to size if needed.
return convertStringToBinaryString(v, Const.trimToType(svalue, v.getTrimType()));
}
} else {
return v.getBinaryString(valueData);
}
}
示例4: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private byte[] formatField(ValueMetaInterface v, Object valueData) throws KettleValueException
{
if( v.isString() )
{
String svalue = (valueData instanceof String)?(String)valueData:v.getString(valueData);
return convertStringToBinaryString(v,Const.trimToType(svalue, v.getTrimType()));
}
else
{
return v.getBinaryString(valueData);
}
}
示例5: writeField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* Writes an individual field to the temp file.
* @param v The metadata about the column
* @param valueData The data for the column
* @param nullString The bytes to put in the temp file if the value is null
* @throws KettleStepException
*/
private void writeField( ValueMetaInterface v, Object valueData, byte[] nullString ) throws KettleStepException {
try {
byte[] str;
// First check whether or not we have a null string set
// These values should be set when a null value passes
//
if ( nullString != null && v.isNull( valueData ) ) {
str = nullString;
} else {
str = formatField( v, valueData );
}
if ( str != null && str.length > 0 ) {
List<Integer> enclosures = null;
boolean writeEnclosures = false;
if ( v.isString() ) {
if ( containsSeparatorOrEnclosure( str, data.binarySeparator, data.binaryEnclosure,
data.escapeCharacters ) ) {
writeEnclosures = true;
}
}
if ( writeEnclosures ) {
data.writer.write( data.binaryEnclosure );
enclosures = getEnclosurePositions( str );
}
if ( enclosures == null ) {
data.writer.write( str );
} else {
// Skip the enclosures, escape them instead...
int from = 0;
for ( Integer enclosure : enclosures ) {
// Minus one to write the escape before the enclosure
int position = enclosure;
data.writer.write( str, from, position - from );
data.writer.write( data.escapeCharacters ); // write enclosure a second time
//data.writer.write( str, position, 1 );
from = position;
}
if ( from < str.length ) {
data.writer.write( str, from, str.length - from );
}
}
if ( writeEnclosures ) {
data.writer.write( data.binaryEnclosure );
}
}
} catch ( Exception e ) {
throw new KettleStepException( "Error writing field content to file", e );
}
}
示例6: writeField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private void writeField(ValueMetaInterface v, Object valueData, byte[] nullString) throws KettleStepException {
try {
byte[] str;
// First check whether or not we have a null string set
// These values should be set when a null value passes
if (nullString != null && v.isNull(valueData)) {
str = nullString;
} else {
str = formatField(v, valueData);
}
if (str != null && str.length > 0) {
List<Integer> enclosures = null;
boolean writeEnclosures = false;
if (v.isString() && containsSeparatorOrEnclosure(str, binarySeparator, binaryEnclosure)) {
writeEnclosures = true;
}
if (writeEnclosures) {
data.writer.write(binaryEnclosure);
enclosures = getEnclosurePositions(str);
}
if (enclosures == null) {
data.writer.write(str);
} else {
int from = 0;
for (int position : enclosures) {
data.writer.write(str, from, position + binaryEnclosure.length - from);
data.writer.write(binaryEnclosure); // write enclosure a second time
from = position + binaryEnclosure.length;
}
if (from < str.length) {
data.writer.write(str, from, str.length - from);
}
}
if (writeEnclosures) {
data.writer.write(binaryEnclosure);
}
}
} catch (Exception e) {
throw new KettleStepException("Error writing field content to file", e);
}
}
示例7: writeField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private void writeField(ValueMetaInterface v, Object valueData, byte[] nullString) throws KettleStepException
{
try
{
byte[] str;
// First check whether or not we have a null string set
// These values should be set when a null value passes
//
if (nullString!=null && v.isNull(valueData)) {
str = nullString;
}
else {
if (meta.isFastDump()) {
if( valueData instanceof byte[] )
{
str = (byte[]) valueData;
} else {
str = getBinaryString((valueData == null) ? "" : valueData.toString());
}
}
else {
str = formatField(v, valueData);
}
}
if (str!=null && str.length>0)
{
List<Integer> enclosures = null;
if (v.isString() && meta.isEnclosureForced() && !meta.isPadded())
{
data.writer.write(data.binaryEnclosure);
// Also check for the existence of the enclosure character.
// If needed we double (escape) the enclosure character.
//
enclosures = getEnclosurePositions(str);
}
if (enclosures == null)
{
data.writer.write(str);
}
else
{
// Skip the enclosures, double them instead...
int from=0;
for (int i=0;i<enclosures.size();i++)
{
int position = enclosures.get(i);
data.writer.write(str, from, position + data.binaryEnclosure.length - from);
data.writer.write(data.binaryEnclosure); // write enclosure a second time
from=position+data.binaryEnclosure.length;
}
if (from<str.length)
{
data.writer.write(str, from, str.length-from);
}
}
if (v.isString() && meta.isEnclosureForced() && !meta.isPadded())
{
data.writer.write(data.binaryEnclosure);
}
}
}
catch(Exception e)
{
throw new KettleStepException("Error writing field content to file", e);
}
}
示例8: writeField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private void writeField(ValueMetaInterface v, Object valueData, byte[] nullString) throws KettleStepException
{
try
{
byte[] str;
// First check whether or not we have a null string set
// These values should be set when a null value passes
//
if (nullString!=null && v.isNull(valueData)) {
str = nullString;
}
else {
if (meta.isFastDump()) {
if( valueData instanceof byte[] )
{
str = (byte[]) valueData;
} else {
str = getBinaryString((valueData == null) ? "" : valueData.toString());
}
}
else {
str = formatField(v, valueData);
}
}
if (str!=null && str.length>0)
{
List<Integer> enclosures = null;
boolean writeEnclosures = false;
if(v.isString()) {
if (meta.isEnclosureForced() && !meta.isPadded())
{
writeEnclosures = true;
} else if(!meta.isEnclosureFixDisabled() && containsSeparatorOrEnclosure(str, data.binarySeparator, data.binaryEnclosure)) {
writeEnclosures = true;
}
}
if(writeEnclosures) {
data.writer.write(data.binaryEnclosure);
enclosures = getEnclosurePositions(str);
}
if (enclosures == null)
{
data.writer.write(str);
}
else
{
// Skip the enclosures, double them instead...
int from=0;
for (int i=0;i<enclosures.size();i++)
{
int position = enclosures.get(i);
data.writer.write(str, from, position + data.binaryEnclosure.length - from);
data.writer.write(data.binaryEnclosure); // write enclosure a second time
from=position+data.binaryEnclosure.length;
}
if (from<str.length)
{
data.writer.write(str, from, str.length-from);
}
}
if (writeEnclosures)
{
data.writer.write(data.binaryEnclosure);
}
}
}
catch(Exception e)
{
throw new KettleStepException("Error writing field content to file", e);
}
}