Example usage for java.io DataOutput writeUTF

List of usage examples for java.io DataOutput writeUTF

Introduction

In this page you can find the example usage for java.io DataOutput writeUTF.

Prototype

void writeUTF(String s) throws IOException;

Source Link

Document

Writes two bytes of length information to the output stream, followed by the modified UTF-8 representation of every character in the string s.

Usage

From source file:com.vmware.demo.sgf.tests.domain.Person.java

@Override
public void toData(DataOutput out) throws IOException {
    out.writeInt(Id);//from  w  ww  .  j  av a2s.c o  m
    out.writeUTF(firstname);
    out.writeUTF(surname);
    out.writeUTF(zipcode);
    DataSerializer.writeDate(dateofBirth, out);
}

From source file:com.aliyun.openservices.tablestore.hadoop.Endpoint.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeByte(WritableConsts.ENDPOINT);
    out.writeUTF(endpoint);
    out.writeUTF(instance);/*  w w  w.j  a va2 s .c o  m*/
}

From source file:com.aliyun.openservices.tablestore.hadoop.Credential.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeByte(WritableConsts.CREDENTIAL);
    out.writeUTF(accessKeyId);
    out.writeUTF(accessKeySecret);//from w  w  w .j  av a 2  s .c  o  m
    if (securityToken != null) {
        out.writeByte(WritableConsts.CREDENTIAL_SECURITY_TOKEN);
        out.writeUTF(securityToken);
    }
}

From source file:com.kylinolap.dict.DateStrDictionary.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeUTF(pattern);
    out.writeInt(baseId);
}

From source file:org.apache.hadoop.mapred.JTAddress.java

public void write(DataOutput out) throws IOException {
    if (address == null) {
        out.writeUTF("");
        out.writeInt(0);/*w  w w  . jav  a 2 s .  co  m*/
    } else {
        out.writeUTF(address.getAddress().getHostName());
        out.writeInt(address.getPort());
    }
}

From source file:org.apache.hadoop.hbase.HServerAddress.java

public void write(DataOutput out) throws IOException {
    if (this.address == null) {
        out.writeUTF("");
        out.writeInt(0);//  w ww  . j a va 2 s  . c  om
    } else {
        out.writeUTF(this.address.getAddress().getHostName());
        out.writeInt(this.address.getPort());
    }
}

From source file:org.openxdata.server.service.impl.FormDownloadServiceTest.java

@Test
@Ignore("throws too many exceptions")
public void testSubmitForms_noSerializer() throws Exception {

    // create the stream
    final PipedOutputStream pout = new PipedOutputStream();
    DataInputStream in = new DataInputStream(new PipedInputStream(pout));
    Thread thread = new Thread(new Runnable() {
        @Override//w w w.  j a  v  a 2  s . c o  m
        public void run() {
            DataOutput output = new DataOutputStream(pout);
            try {
                output.writeByte(1);
                output.writeUTF(XFormsFixture.getSampleFormModelData());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
    thread.start();
    DataOutputStream out = new DataOutputStream(new ByteArrayOutputStream());

    // run test
    formDownloadService.submitForms(in, out, null);

    // do checks afterwards
    List<FormDataHeader> formData = studyManagerService.getFormData(12, null, null, null);
    Assert.assertEquals("after submit there is 1 form data", 1, formData.size());
}

From source file:org.mitre.la.mapred.io.DenseVectorWritable.java

/**
 * Serialize the fields of this object to <code>out</code>.
 *
 * @param out <code>DataOuput</code> to serialize this object into.
 * @throws IOException//from w w w.  ja  v a2  s. c o  m
 */
@Override
public void write(DataOutput out) throws IOException {
    int length = this.dv.getCardinality();
    out.writeByte(0); // Space for versioning
    out.writeUTF(this.dv.getLabel());
    out.writeInt(length);
    for (int i = 0; i < length; i++) {
        out.writeDouble(this.dv.get(i));
    }
}

From source file:org.apache.hama.bsp.BSPMessageBundle.java

@SuppressWarnings("unchecked")
@Override// ww  w. j av  a2 s . c  o  m
public void write(DataOutput out) throws IOException {
    out.writeInt(messages.size());

    if (messages.size() > 0) {
        Class<M> clazz = (Class<M>) messages.get(0).getClass();
        out.writeUTF(clazz.getName());

        for (M m : messages) {
            m.write(out);
        }
    }
}

From source file:org.apache.hadoop.hive.ql.io.BucketizedHiveInputSplit.java

@Override
public void write(DataOutput out) throws IOException {
    assert (inputSplits != null && inputSplits.length > 0);
    out.writeUTF(inputSplits[0].getClass().getName());
    out.writeInt(inputSplits.length);//from   ww  w  .j  a  va  2 s . c o  m
    for (InputSplit inputSplit : inputSplits) {
        inputSplit.write(out);
    }
    out.writeUTF(inputFormatClassName);
}