public InputStream getInputStream() { return new ByteArrayInputStream(getBytesNoCopy()); }
/** * Get the input stream * * @param oneBasedOffset the offset (1 means no offset) * @param length the requested length * @return the new input stream */ public InputStream getInputStream(long oneBasedOffset, long length) { byte[] bytes = getBytesNoCopy(); long zeroBasedOffset = oneBasedOffset - 1; rangeCheck(zeroBasedOffset, length, bytes.length); return new ByteArrayInputStream(bytes, (int) zeroBasedOffset, (int) length); }
/** * @param val Value. */ public GridH2Geometry(Value val) { assert val.getType() == Value.GEOMETRY : val.getType(); b = val.getBytesNoCopy(); }
/** * @param val Value. */ public GridH2JavaObject(Value val) { assert val.getType() == Value.JAVA_OBJECT : val.getType(); b = val.getBytesNoCopy(); }
/** * @param val Value. */ public GridH2Bytes(Value val) { assert val.getType() == Value.BYTES : val.getType(); b = val.getBytesNoCopy(); }
@Override protected int compareSecure(Value v, CompareMode mode) { if (type == Value.CLOB) { return Integer.signum(getString().compareTo(v.getString())); } byte[] v2 = v.getBytesNoCopy(); return Bits.compareNotNullSigned(getBytesNoCopy(), v2); }
@Override protected int compareSecure(Value v, CompareMode mode) { if (v instanceof ValueLobDb) { ValueLobDb v2 = (ValueLobDb) v; if (v == this) { return 0; } if (lobId == v2.lobId && small == null && v2.small == null) { return 0; } } if (type == Value.CLOB) { return Integer.signum(getString().compareTo(v.getString())); } byte[] v2 = v.getBytesNoCopy(); return Bits.compareNotNullSigned(getBytesNoCopy(), v2); }
@Override protected int compareSecure(Value v, CompareMode mode) { Object o1 = getObject(); Object o2 = v.getObject(); boolean o1Comparable = o1 instanceof Comparable; boolean o2Comparable = o2 instanceof Comparable; if (o1Comparable && o2Comparable && Utils.haveCommonComparableSuperclass(o1.getClass(), o2.getClass())) { @SuppressWarnings("unchecked") Comparable<Object> c1 = (Comparable<Object>) o1; return c1.compareTo(o2); } // group by types if (o1.getClass() != o2.getClass()) { if (o1Comparable != o2Comparable) { return o1Comparable ? -1 : 1; } return o1.getClass().getName().compareTo(o2.getClass().getName()); } // compare hash codes int h1 = hashCode(); int h2 = v.hashCode(); if (h1 == h2) { if (o1.equals(o2)) { return 0; } return Bits.compareNotNullSigned(getBytesNoCopy(), v.getBytesNoCopy()); } return h1 > h2 ? 1 : -1; }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected int compareSecure(Value v, CompareMode mode) { Object o1 = getObject(); Object o2 = v.getObject(); boolean o1Comparable = o1 instanceof Comparable; boolean o2Comparable = o2 instanceof Comparable; if (o1Comparable && o2Comparable && Utils.haveCommonComparableSuperclass(o1.getClass(), o2.getClass())) { Comparable<Object> c1 = (Comparable<Object>)o1; return c1.compareTo(o2); } // Group by types. if (o1.getClass() != o2.getClass()) { if (o1Comparable != o2Comparable) return o1Comparable ? -1 : 1; return o1.getClass().getName().compareTo(o2.getClass().getName()); } // Compare hash codes. int h1 = hashCode(); int h2 = v.hashCode(); if (h1 == h2) { if (o1.equals(o2)) return 0; return Bits.compareNotNullSigned(getBytesNoCopy(), v.getBytesNoCopy()); } return h1 > h2 ? 1 : -1; }
@Override public byte[] getBytesNoCopy() { if (type == CLOB) { // convert hex to string return super.getBytesNoCopy(); } if (small != null) { return small; } try { return IOUtils.readBytesAndClose( getInputStream(), Integer.MAX_VALUE); } catch (IOException e) { throw DbException.convertIOException(e, fileName); } }
@Override public byte[] getBytesNoCopy() { if (type == CLOB) { // convert hex to string return super.getBytesNoCopy(); } if (small != null) { return small; } try { return IOUtils.readBytesAndClose(getInputStream(), Integer.MAX_VALUE); } catch (IOException e) { throw DbException.convertIOException(e, toString()); } }
byte[] bytes = v.getBytesNoCopy();
return JdbcUtils.deserialize(v.getBytesNoCopy(), session.getDataHandler());
byte[] b = v.getBytesNoCopy(); buff.put((byte) type). putVarInt(b.length). byte[] b = v.getBytesNoCopy(); int len = b.length; if (len < 32) { byte[] b = v.getBytesNoCopy(); buff.put((byte)CUSTOM_DATA_TYPE). putVarInt(type).
v1.getBytesNoCopy(), v2.getInt())); break; case ENCRYPT: result = ValueBytes.getNoCopy(encrypt(v0.getString(), v1.getBytesNoCopy(), v2.getBytesNoCopy())); break; case DECRYPT: result = ValueBytes.getNoCopy(decrypt(v0.getString(), v1.getBytesNoCopy(), v2.getBytesNoCopy())); break; case COMPRESS: { compress(v0.getBytesNoCopy(), algorithm)); break;
case EXPAND: result = ValueBytes.getNoCopy( CompressTool.getInstance().expand(v0.getBytesNoCopy())); break; case ZERO: break; case UTF8TOSTRING: result = ValueString.get(new String(v0.getBytesNoCopy(), StandardCharsets.UTF_8), database.getMode().treatEmptyStringsAsNull);
/** * @param val Value. */ public GridH2Geometry(Value val) { assert val.getType() == Value.GEOMETRY : val.getType(); b = val.getBytesNoCopy(); }
/** * @param val Value. */ public GridH2Bytes(Value val) { assert val.getType() == Value.BYTES : val.getType(); b = val.getBytesNoCopy(); }
/** * @param val Value. */ public GridH2JavaObject(Value val) { assert val.getType() == Value.JAVA_OBJECT : val.getType(); b = val.getBytesNoCopy(); }
@Override protected int compareSecure(Value v, CompareMode mode) { if (type == Value.CLOB) { return Integer.signum(getString().compareTo(v.getString())); } byte[] v2 = v.getBytesNoCopy(); return Utils.compareNotNullSigned(getBytes(), v2); }