/** * Set the encoding. If the object was constructed from bytes[]. any previous conversion is reset. * If no encoding is set, we'll use 8859-1. */ public void setEncoding(String enc) { if (!byteC.isNull()) { // if the encoding changes we need to reset the converion results charC.recycle(); hasStrValue = false; } byteC.setEncoding(enc); }
/** * Set the encoding. If the object was constructed from bytes[]. any previous conversion is reset. * If no encoding is set, we'll use 8859-1. */ public void setCharset(Charset charset) { if (!byteC.isNull()) { // if the encoding changes we need to reset the conversion results charC.recycle(); hasStrValue = false; } byteC.setCharset(charset); }
/** Unimplemented yet. Do a char->byte conversion. */ public void toBytes() { if (!byteC.isNull()) { type = T_BYTES; return; } toString(); type = T_BYTES; byte bb[] = strValue.getBytes(); byteC.setBytes(bb, 0, bb.length); }
public boolean isNull() { // should we check also hasStrValue ??? return byteC.isNull() && charC.isNull() && !hasStrValue; // bytes==null && strValue==null; }