Java Code Examples for org.datavec.api.writable.Text#write()

The following examples show how to use org.datavec.api.writable.Text#write() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LineRecordWriter.java    From DataVec with Apache License 2.0 5 votes vote down vote up
@Override
public PartitionMetaData write(List<Writable> record) throws IOException {
    if (!record.isEmpty()) {
        Text t = (Text) record.iterator().next();
        t.write(out);
        out.write(NEW_LINE.getBytes());
    }


    return PartitionMetaData.builder().numRecordsUpdated(1).build();

}
 
Example 2
Source File: FileRecordWriter.java    From DataVec with Apache License 2.0 5 votes vote down vote up
@Override
public PartitionMetaData write(List<Writable> record) throws IOException {
    if (!record.isEmpty()) {
        Text t = (Text) record.iterator().next();
        t.write(out);
    }

    return PartitionMetaData.builder().numRecordsUpdated(1).build();
}
 
Example 3
Source File: FileRecordWriter.java    From DataVec with Apache License 2.0 5 votes vote down vote up
@Override
public PartitionMetaData writeBatch(List<List<Writable>> batch) throws IOException {
    for(List<Writable> record : batch) {
        Text t = (Text) record.iterator().next();
        try {
            t.write(out);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }
    return PartitionMetaData.builder().numRecordsUpdated(1).build();

}
 
Example 4
Source File: LineRecordWriter.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public PartitionMetaData write(List<Writable> record) throws IOException {
    if (!record.isEmpty()) {
        Text t = (Text) record.iterator().next();
        t.write(out);
        out.write(NEW_LINE.getBytes());
    }


    return PartitionMetaData.builder().numRecordsUpdated(1).build();

}