Example usage for org.apache.hadoop.mapreduce.lib.input FileSplit readFields

List of usage examples for org.apache.hadoop.mapreduce.lib.input FileSplit readFields

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce.lib.input FileSplit readFields.

Prototype

@Override
    public void readFields(DataInput in) throws IOException 

Source Link

Usage

From source file:org.apache.ignite.internal.processors.hadoop.impl.v2.HadoopV2Splitter.java

License:Apache License

/**
 * @param clsName Input split class name.
 * @param in Input stream.//from   www. j  a  va 2s .  c o m
 * @param hosts Optional hosts.
 * @return File block or {@code null} if it is not a {@link FileSplit} instance.
 * @throws IgniteCheckedException If failed.
 */
public static HadoopFileBlock readFileBlock(String clsName, DataInput in, @Nullable String[] hosts)
        throws IgniteCheckedException {
    if (!FileSplit.class.getName().equals(clsName))
        return null;

    FileSplit split = new FileSplit();

    try {
        split.readFields(in);
    } catch (IOException e) {
        throw new IgniteCheckedException(e);
    }

    if (hosts == null)
        hosts = EMPTY_HOSTS;

    return new HadoopFileBlock(hosts, split.getPath().toUri(), split.getStart(), split.getLength());
}

From source file:org.apache.ignite.internal.processors.hadoop.v2.GridHadoopV2Splitter.java

License:Apache License

/**
 * @param clsName Input split class name.
 * @param in Input stream.//from   w w  w. j a  v  a 2 s . c  o m
 * @param hosts Optional hosts.
 * @return File block or {@code null} if it is not a {@link FileSplit} instance.
 * @throws IgniteCheckedException If failed.
 */
public static GridHadoopFileBlock readFileBlock(String clsName, DataInput in, @Nullable String[] hosts)
        throws IgniteCheckedException {
    if (!FileSplit.class.getName().equals(clsName))
        return null;

    FileSplit split = new FileSplit();

    try {
        split.readFields(in);
    } catch (IOException e) {
        throw new IgniteCheckedException(e);
    }

    if (hosts == null)
        hosts = EMPTY_HOSTS;

    return new GridHadoopFileBlock(hosts, split.getPath().toUri(), split.getStart(), split.getLength());
}

From source file:org.gridgain.grid.kernal.processors.hadoop.v2.GridHadoopV2Splitter.java

License:Open Source License

/**
 * @param clsName Input split class name.
 * @param in Input stream./*from  www.  j a  va  2  s. c  o m*/
 * @param hosts Optional hosts.
 * @return File block or {@code null} if it is not a {@link FileSplit} instance.
 * @throws GridException If failed.
 */
public static GridHadoopFileBlock readFileBlock(String clsName, DataInput in, @Nullable String[] hosts)
        throws GridException {
    if (!FileSplit.class.getName().equals(clsName))
        return null;

    FileSplit split = new FileSplit();

    try {
        split.readFields(in);
    } catch (IOException e) {
        throw new GridException(e);
    }

    if (hosts == null)
        hosts = EMPTY_HOSTS;

    return new GridHadoopFileBlock(hosts, split.getPath().toUri(), split.getStart(), split.getLength());
}