/** Read a UTF8 encoded string from in */ public static String readString(DataInput in) throws IOException { return readString(in, Integer.MAX_VALUE); }
@Override public void readFields(DataInput in) throws IOException { Text.readString(in); } }
@Override public void readFields(DataInput dataInput) throws IOException { this.localLocation = Text.readString(dataInput); this.dfsLocation = Text.readString(dataInput); } }
public void readFields(DataInput in) throws IOException { brokers = Text.readString(in); topic = Text.readString(in); partition = in.readInt(); offsetStart = in.readLong(); offsetEnd = in.readLong(); }
/** * Read an Enum value from DataInput, Enums are read and written * using String values. * @param <T> Enum type * @param in DataInput to read from * @param enumType Class type of Enum * @return Enum represented by String read from DataInput * @throws IOException */ public static <T extends Enum<T>> T readEnum(DataInput in, Class<T> enumType) throws IOException{ return T.valueOf(enumType, Text.readString(in)); } /**
@Override public void readFields(DataInput dataInput) throws IOException { this.owner = Text.readString(dataInput); this.group = Text.readString(dataInput); this.fsPermission = FsPermission.read(dataInput); }
@Override public void readFields(DataInput dataInput) throws IOException { this.aliasName = Text.readString(dataInput); this.paths = new ArrayList<>(); int size = dataInput.readInt(); for (int i = 0; i < size; i++) { this.paths.add(new Path(Text.readString(dataInput))); } } }
@Override public void readFields(DataInput in) throws IOException { username = Text.readString(in, Text.DEFAULT_MAX_LEN); groupname = Text.readString(in, Text.DEFAULT_MAX_LEN); permission = FsPermission.read(in); }
@Override public void readFields(DataInput dataInput) throws IOException { this.xlearningContainerStatus = WritableUtils.readEnum(dataInput, XLearningContainerStatus.class); interResultSavedStatus.readFields(dataInput); this.progressLog = Text.readString(dataInput); this.containersStartTime = Text.readString(dataInput); this.containersFinishTime = Text.readString(dataInput); }
@Override public void readFields(DataInput in) throws IOException { clear(); int size = WritableUtils.readVInt(in); for(int i=0; i < size; ++i) { String key = org.apache.hadoop.io.Text.readString(in); String value = org.apache.hadoop.io.Text.readString(in); set(key, value); String sources[] = WritableUtils.readCompressedStringArray(in); if(sources != null) { updatingResource.put(key, sources); } } }
@Override public void readFields(DataInput dataInput) throws IOException { this.logType = WritableUtils.readEnum(dataInput, LogType.class); this.message = Text.readString(dataInput); } }
/** * Deserializes the AccessControlList object */ @Override public void readFields(DataInput in) throws IOException { String aclString = Text.readString(in); buildACL(aclString.split(" ", 2)); }
private Class<?> readClass(DataInput in) throws IOException { String className = Text.readString(in); try { return conf.getClassByName(className); } catch (ClassNotFoundException e) { throw new RuntimeException("readObject can't find class", e); } }
@Override public void readFields(DataInput dataInput) throws IOException { this.containerId = ConverterUtils.toContainerId(Text.readString(dataInput)); }
public void readFields(DataInput in) throws IOException { path = new Path(Text.readString(in)); delegate.readFields(in); }
@Override public void readFields(DataInput in) throws IOException { clear(); int size = WritableUtils.readVInt(in); for(int i=0; i < size; ++i) { String key = org.apache.hadoop.io.Text.readString(in); String value = org.apache.hadoop.io.Text.readString(in); set(key, value); String sources[] = WritableUtils.readCompressedStringArray(in); if (sources != null) { putIntoUpdatingResource(key, sources); } } }
@Override public void readFields(DataInput in) throws IOException { clear(); int size = WritableUtils.readVInt(in); for(int i=0; i < size; ++i) { String key = org.apache.hadoop.io.Text.readString(in); String value = org.apache.hadoop.io.Text.readString(in); set(key, value); String sources[] = WritableUtils.readCompressedStringArray(in); if (sources != null) { putIntoUpdatingResource(key, sources); } } }
@SuppressWarnings("unchecked") public void readFields(DataInput in) throws IOException { inputSplitClass = (Class<? extends InputSplit>) readClass(in); inputSplit = (InputSplit) ReflectionUtils .newInstance(inputSplitClass, conf); inputSplit.readFields(in); inputFormatClass = (Class<? extends InputFormat>) readClass(in); mapperClass = (Class<? extends AvroMapper>) readClass(in); String schemaString = Text.readString(in); schema = schemaParser.parse(schemaString); }
private static List<Permission> readWritableUserPermission(DataInput in, Configuration conf) throws IOException, ClassNotFoundException { assert WritableUtils.readVInt(in) == LIST_CODE; int length = in.readInt(); List<Permission> list = new ArrayList<>(length); for (int i = 0; i < length; i++) { assert WritableUtils.readVInt(in) == WRITABLE_CODE; assert WritableUtils.readVInt(in) == WRITABLE_NOT_ENCODED; String className = Text.readString(in); Class<? extends Writable> clazz = conf.getClassByName(className).asSubclass(Writable.class); Writable instance = WritableFactories.newInstance(clazz, conf); instance.readFields(in); list.add((Permission) instance); } return list; }
public static ListMultimap<String, Permission> readPermissions(byte[] data, Configuration conf) throws DeserializationException { if (ProtobufUtil.isPBMagicPrefix(data)) { int pblen = ProtobufUtil.lengthOfPBMagic(); try { AccessControlProtos.UsersAndPermissions.Builder builder = AccessControlProtos.UsersAndPermissions.newBuilder(); ProtobufUtil.mergeFrom(builder, data, pblen, data.length - pblen); return AccessControlUtil.toPermission(builder.build()); } catch (IOException e) { throw new DeserializationException(e); } } else { // TODO: We have to re-write non-PB data as PB encoded. Otherwise we will carry old Writables // forever (here and a couple of other places). ListMultimap<String, Permission> perms = ArrayListMultimap.create(); try { DataInput in = new DataInputStream(new ByteArrayInputStream(data)); int length = in.readInt(); for (int i = 0; i < length; i++) { String user = Text.readString(in); perms.putAll(user, readWritableUserPermission(in, conf)); } } catch (IOException | ClassNotFoundException e) { throw new DeserializationException(e); } return perms; } }