Example usage for org.apache.hadoop.io Text writeString

List of usage examples for org.apache.hadoop.io Text writeString

Introduction

In this page you can find the example usage for org.apache.hadoop.io Text writeString.

Prototype

public static int writeString(DataOutput out, String s) throws IOException 

Source Link

Document

Write a UTF8 encoded string to out

Usage

From source file:com.marklogic.mapreduce.StreamLocator.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, path.toString());
    WritableUtils.writeEnum(out, codec);
}

From source file:com.marklogic.mapreduce.utilities.ForestInfo.java

License:Apache License

public void write(DataOutput out) throws IOException {
    Text.writeString(out, hostName);
    out.writeLong(frangmentCount);
    out.writeBoolean(updatable);
}

From source file:com.pivotal.hawq.mapreduce.ao.file.HAWQAOSplit.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    super.write(out);
    out.writeBoolean(checksum);/*  w  ww  .j  a  v  a 2s .  c om*/
    Text.writeString(out, compressType);
    out.writeInt(blockSize);
}

From source file:com.sensei.indexing.hadoop.keyvalueformat.Shard.java

License:Apache License

public void write(DataOutput out) throws IOException {
    out.writeLong(version);
    Text.writeString(out, dir);
    out.writeLong(gen);
}

From source file:com.sensei.indexing.hadoop.reduce.RAMDirectoryUtil.java

License:Apache License

/**
 * Write a number of files from a ram directory to a data output.
 * @param out  the data output//from w ww.j  a va  2s.c  om
 * @param dir  the ram directory
 * @param names  the names of the files to write
 * @throws IOException
 */
public static void writeRAMFiles(DataOutput out, RAMDirectory dir, String[] names) throws IOException {
    out.writeInt(names.length);

    for (int i = 0; i < names.length; i++) {
        Text.writeString(out, names[i]);
        long length = dir.fileLength(names[i]);
        out.writeLong(length);

        if (length > 0) {
            // can we avoid the extra copy?
            IndexInput input = null;
            try {
                input = dir.openInput(names[i], BUFFER_SIZE);

                int position = 0;
                byte[] buffer = new byte[BUFFER_SIZE];

                while (position < length) {
                    int len = position + BUFFER_SIZE <= length ? BUFFER_SIZE : (int) (length - position);
                    input.readBytes(buffer, 0, len);
                    out.write(buffer, 0, len);
                    position += len;
                }
            } finally {
                if (input != null) {
                    input.close();
                }
            }
        }
    }
}

From source file:com.soteradefense.dga.hbse.HighBetweennessList.java

License:Apache License

/**
 * Write fields//from w  ww.j  a va 2 s. c  o  m
 */
public void write(DataOutput out) throws IOException {
    out.writeInt(maxSize);
    int size = (highBetweennessQueue == null) ? 0 : highBetweennessQueue.size();
    out.writeInt(size);
    if (highBetweennessQueue != null) {
        for (BcTuple t : highBetweennessQueue) {
            Text.writeString(out, t.id);
            out.writeDouble(t.value);
        }
    }
}

From source file:com.soteradefense.dga.hbse.PathData.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, source);
    Text.writeString(out, from);//  w w  w . j av a2s. com
    Text.writeString(out, distance.toString());
    Text.writeString(out, numPaths.toString());

    out.writeDouble(dependency);
}

From source file:com.soteradefense.dga.hbse.PivotList.java

License:Apache License

@Override
public void write(DataOutput dataOutput) throws IOException {
    dataOutput.writeInt(pivots.size());//  ww  w.  j av a  2 s.c o m
    for (String s : pivots) {
        Text.writeString(dataOutput, s);
    }
}

From source file:com.soteradefense.dga.hbse.ShortestPathList.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, distance.toString());
    out.writeInt(this.predecessorPathCountMap.size());
    for (Entry<String, BigInteger> entry : predecessorPathCountMap.entrySet()) {
        Text.writeString(out, entry.getKey());
        Text.writeString(out, entry.getValue().toString());
    }/*w  w w. j a v  a 2 s.c  o m*/

}

From source file:com.soteradefense.dga.hbse.VertexData.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    out.writeBoolean(wasPivotPoint);//from w  w  w  . jav  a2 s . co  m
    out.writeDouble(approxBetweenness);
    out.writeInt(pathDataMap.size());
    for (Entry<String, ShortestPathList> entry : pathDataMap.entrySet()) {
        Text.writeString(out, entry.getKey());
        entry.getValue().write(out);
    }

    out.writeInt(this.partialDepMap.size());
    for (Entry<String, PartialDependency> entry : partialDepMap.entrySet()) {
        Text.writeString(out, entry.getKey());
        entry.getValue().write(out);
    }
}