/** * Create a LOB object that fits in memory. * * @param type the type (Value.BLOB or CLOB) * @param small the byte array * @return the LOB */ public static Value createSmallLob(int type, byte[] small) { int precision; if (type == Value.CLOB) { precision = new String(small, Constants.UTF8).length(); } else { precision = small.length; } return createSmallLob(type, small, precision); }
/** * Convert a lob to another data type. The data is fully read in memory * except when converting to BLOB or CLOB. * * @param t the new type * @return the converted value */ @Override public Value convertTo(int t) { if (t == type) { return this; } else if (t == Value.CLOB) { if (small != null) { return ValueLobDb.createSmallLob(t, small); } else { return ValueLobDb.createTempClob(getReader(), -1); } } else if (t == Value.BLOB) { if (small != null) { return ValueLobDb.createSmallLob(t, small); } else { return ValueLobDb.createTempBlob(getInputStream(), -1); } } return super.convertTo(t); }
return ValueLobDb.createSmallLob(Value.CLOB, small, len);
byte[] small = DataUtils.newBytes(len); System.arraycopy(buff, 0, small, 0, len); return ValueLobDb.createSmallLob(Value.BLOB, small, small.length);
switch (getType()) { case BYTES: return ValueLobDb.createSmallLob( Value.BLOB, getBytesNoCopy()); return ValueFloat.get(Float.parseFloat(s.trim())); case CLOB: return ValueLobDb.createSmallLob( CLOB, s.getBytes(Constants.UTF8)); case BLOB: return ValueLobDb.createSmallLob( BLOB, StringUtils.convertHexToBytes(s.trim())); case ARRAY: