public ListValueType(TypeManager typeManager, DataInput typeParamsDataInput) throws RepositoryException, InterruptedException { this(typeManager, typeParamsDataInput.readUTF()); }
public PathValueType(TypeManager typeManager, DataInput typeParamsDataInput) throws RepositoryException, InterruptedException { this(typeManager, typeParamsDataInput.readUTF()); }
@Override @SuppressWarnings("unchecked") public BigDecimal read(DataInput dataInput) { return new BigDecimal(dataInput.readUTF()); }
@Override public URI read(DataInput dataInput) { return URI.create(dataInput.readUTF()); }
@Override @SuppressWarnings("unchecked") public String read(DataInput dataInput) { // Read the encoding version byte, but ignore it for the moment since there is only one encoding dataInput.readByte(); return dataInput.readUTF(); }
DerefMapVariantPropertiesPattern deserializeVariantPropertiesPattern(DataInput dataInput) { final Map<String, String> pattern = new HashMap<String, String>(); final int nEntries = dataInput.readInt(); while (pattern.size() < nEntries) { final String name = dataInput.readUTF(); final String value = dataInput.readUTF(); pattern.put(name, value); } return new DerefMapVariantPropertiesPattern(pattern); }
@Override public RecordId fromBytes(DataInput dataInput, IdGeneratorImpl idGenerator) { if (dataInput.indexOf((byte) 0) != -1) { throw new IllegalArgumentException("The NULL character is not allowed in USER record id's."); } String id = dataInput.readUTF(dataInput.getSize() - dataInput.getPosition()); // read the remainder of the data input return new UserRecordId(id, idGenerator); }
/** * See write for the byte format. */ @Override @SuppressWarnings("unchecked") public Blob read(DataInput dataInput) { // Read the encoding version byte, but ignore it for the moment since there is only one encoding dataInput.readByte(); int keyLength = dataInput.readVInt(); byte[] key = null; if (keyLength > 0) { key = dataInput.readBytes(keyLength); } String mediaType = dataInput.readUTF(); Long size = dataInput.readLong(); if (size == -1) { size = null; } String filename = dataInput.readUTF(); return new Blob(key, mediaType, size, filename); }
private ValueType decodeValueType(byte[] bytes) throws RepositoryException, InterruptedException { DataInput dataInput = new DataInputImpl(bytes); if (valueTypeEncodingVersion != dataInput.readByte()) { throw new TypeException("Unknown value type encoding version encountered in schema"); } return getValueType(dataInput.readUTF()); }
/** * Decodes links from Lily 2.0 and earlier (before table name was added to Link serialization). */ public static Link decode(DataInput dataInput, IdGenerator idGenerator) { // The bytes format is as follows: // [byte representation of master record id, if not null][args: bytes of the string representation] int recordIdLength = dataInput.readInt(); byte[] recordIdBytes = null; if (recordIdLength > 0) { recordIdBytes = dataInput.readBytes(recordIdLength); } String args = dataInput.readUTF(); if (recordIdLength == 0 && args == null) { return new Link(); } LinkBuilder builder = Link.newBuilder(); if (recordIdLength > 0) { RecordId id = idGenerator.fromBytes(recordIdBytes); builder.recordId(id); } if (args != null && args.length() > 0) { argsFromString(args, builder, args /* does not matter, should never be invalid */); } return builder.create(); }
public static Link decodeLink(DataInput dataInput, IdGenerator idGenerator) { // Format: see toBytes. int recordIdLength = dataInput.readInt(); byte[] recordIdBytes = null; if (recordIdLength > 0) { recordIdBytes = dataInput.readBytes(recordIdLength); } String args = dataInput.readUTF(); if (recordIdLength == 0 && args == null) { return new Link(); } Link.LinkBuilder builder = Link.newBuilder(); if (recordIdLength > 0) { RecordId id = decode(new DataInputImpl(recordIdBytes), idGenerator); builder.recordId(id); } if (args != null && args.length() > 0) { argsFromString(args, builder, args /* does not matter, should never be invalid */); } return builder.create(); }
public static Link read(DataInput dataInput, IdGenerator idGenerator) { // Format: see write(DataOutput). int tableLength = dataInput.readInt(); byte[] tableBytes = dataInput.readBytes(tableLength); int recordIdLength = dataInput.readInt(); byte[] recordIdBytes = null; if (recordIdLength > 0) { recordIdBytes = dataInput.readBytes(recordIdLength); } String args = dataInput.readUTF(); if (recordIdLength == 0 && args == null) { return new Link(); } LinkBuilder builder = Link.newBuilder(); if (tableLength > 0) { builder.table(new String(tableBytes)); } if (recordIdLength > 0) { RecordId id = idGenerator.fromBytes(recordIdBytes); builder.recordId(id); } if (args != null && args.length() > 0) { argsFromString(args, builder, args /* does not matter, should never be invalid */); } return builder.create(); }