public void getClosedFieldName(ARecordType recordType, int fieldId, DataOutput dOut) throws IOException { dOut.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG); utf8Writer.writeUTF8(getClosedFieldName(recordType, fieldId), dOut); }
public static byte[] writeStringToBytes(String string) { UTF8StringWriter writer = new UTF8StringWriter(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); try { writer.writeUTF8(string, dos); } catch (IOException e) { throw new RuntimeException(e); } return bos.toByteArray(); }
private static byte[] getTempBytes(UTF8StringWriter writer, int utflen) { byte[] tempBytes; if (writer == null) { tempBytes = new byte[utflen + 5]; } else { if (writer.getTempBytes() == null || writer.getTempBytes().length < utflen + 5) { writer.setTempBytes(new byte[utflen + 5]); } tempBytes = writer.getTempBytes(); } return tempBytes; } }
public PointableHelper() { utf8Writer = new UTF8StringWriter(); }
@Override public IValueParser createValueParser() { return new IValueParser() { private UTF8StringWriter writer = new UTF8StringWriter(); @Override public void parse(char[] buffer, int start, int length, DataOutput out) throws HyracksDataException { try { writer.writeUTF8(buffer, start, length, out); } catch (IOException e) { throw HyracksDataException.create(e); } } }; } }
@Override public void parse(char[] buffer, int start, int length, DataOutput out) throws HyracksDataException { try { writer.writeUTF8(buffer, start, length, out); } catch (IOException e) { throw HyracksDataException.create(e); } } };
final UTF8StringWriter utf8Writer = new UTF8StringWriter(); for (int i = 0; i < numberOfSchemaFields; i++) { ATypeTag ftypeTag = fieldTypes[i].getTypeTag(); utf8Writer.writeUTF8(fieldNameStrs[i], typeDos); int nameEnd = typeBos.size(); IVisitablePointable typeNameReference = AFlatValuePointable.FACTORY.create(null);
@SuppressWarnings("rawtypes") public ISerializerDeserializer getAStringSerializerDeserializer() { return addTag(new AStringSerializerDeserializer(new UTF8StringWriter(), new UTF8StringReader())); }
private void parseString(Object obj, StringObjectInspector foi, DataOutput dataOutput) throws IOException { utf8Writer.writeUTF8(foi.getPrimitiveJavaObject(obj), dataOutput); }
public RuntimeRecordTypeInfo() { fieldNameComparator = new PointableBinaryComparatorFactory(UTF8StringPointable.FACTORY).createBinaryComparator(); fieldNameHashFunction = new PointableBinaryHashFunctionFactory(UTF8StringPointable.FACTORY).createBinaryHashFunction(); writer = new UTF8StringWriter(); }
private void writeAndReadOneString(String testString) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); writer.writeUTF8(testString, dos); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray(), 0, bos.size()); assertEquals(testString, reader.readUTF(new DataInputStream(bis))); int lastOffset = bos.size(); char[] charArray = testString.toCharArray(); writer.writeUTF8(charArray, 0, charArray.length, dos); bis = new ByteArrayInputStream(bos.toByteArray(), lastOffset, bos.size()); assertEquals(testString, reader.readUTF(new DataInputStream(bis))); }
/** * @param str * The input string * @param vs * The storage buffer * @param writeTag * Specifying whether a tag for the string should also be written */ public void serializeString(String str, IMutableValueStorage vs, boolean writeTag) throws HyracksDataException { vs.reset(); try { DataOutput output = vs.getDataOutput(); if (writeTag) { output.write(ATypeTag.STRING.serialize()); } utf8Writer.writeUTF8(str, output); } catch (IOException e) { throw new HyracksDataException("Could not serialize " + LogRedactionUtil.userData(str)); } }
case STRING: out.write(BuiltinType.ASTRING.getTypeTag().serialize()); utf8Writer.writeUTF8(fieldObj.asText(), out); break; case BIGINT: } else if (fieldObj.isTextual()) { out.write(BuiltinType.ASTRING.getTypeTag().serialize()); utf8Writer.writeUTF8(fieldObj.asText(), out); } else if (fieldObj.isArray()) { if ((fieldObj).size() != 0) {
for (int i = 0; i < fieldNames.length; ++i) { serializedFieldNameOffsets[i] = baaos.size(); writer.writeUTF8(fieldNames[i], dos); length = baaos.size() - serializedFieldNameOffsets[i]; hashCodeIndexPairs[i] =
utf8Writer.writeUTF8(fname, dos); int nameEnd = bos.size(); IVisitablePointable typeNamePointable = allocator.allocateEmpty();