List of usage examples for java.io DataOutput write
void write(byte b[]) throws IOException;
b
. From source file:cosmos.records.impl.MultimapRecord.java
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, this.docId); byte[] cvBytes = this.docVisibility.getExpression(); WritableUtils.writeVInt(out, cvBytes.length); out.write(cvBytes); WritableUtils.writeVInt(out, this.document.size()); for (Entry<Column, RecordValue<?>> entry : this.document.entries()) { entry.getKey().write(out);/* ww w . jav a2 s . c o m*/ entry.getValue().write(out); } }
From source file:edu.umn.cs.spatialHadoop.core.OGCShape.java
@Override public void write(DataOutput out) throws IOException { byte[] bytes = geom.asBinary().array(); out.writeInt(bytes.length);//from w w w . ja v a 2 s . c o m out.write(bytes); if (extra == null) { out.writeInt(-1); } else { bytes = extra.getBytes(); out.writeInt(bytes.length); out.write(bytes); } }
From source file:com.buaa.cfs.security.token.Token.java
@Override public void write(DataOutput out) throws IOException { WritableUtils.writeVInt(out, identifier.length); out.write(identifier); WritableUtils.writeVInt(out, password.length); out.write(password);/* www .j a va2s . c o m*/ kind.write(out); service.write(out); }
From source file:com.zimbra.common.util.ByteUtil.java
public static void writeUTF8(DataOutput out, String str) throws IOException { // Special case: Null string is serialized as length of -1. if (str == null) { out.writeInt(-1);//from w w w. ja v a 2 s .co m return; } int len = str.length(); if (len > MAX_STRING_LEN) throw new IOException( "String length " + len + " is too long in ByteUtil.writeUTF8(); max=" + MAX_STRING_LEN); if (len > 0) { byte[] buf = str.getBytes("UTF-8"); out.writeInt(buf.length); out.write(buf); } else { out.writeInt(0); } }
From source file:clueweb09.WarcRecord.java
public void write(DataOutput out) throws IOException { warcHeader.write(out); out.write(warcContent); }
From source file:com.ning.metrics.action.hdfs.data.RowSmile.java
/** * Serialize the row into the DataOutput * * @param out DataOutput to write/*from ww w . jav a 2 s . c om*/ * @throws java.io.IOException generic serialization error */ @Override public void write(DataOutput out) throws IOException { schema.write(out); WritableUtils.writeVInt(out, data.size()); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); JsonGenerator gen = objectMapper.getJsonFactory().createJsonGenerator(outStream, JsonEncoding.UTF8); for (JsonNodeComparable dataItem : data) { objectMapper.writeValue(gen, dataItem); } gen.close(); // Size of Smile payload. Needed for deserialization, see below WritableUtils.writeVInt(out, outStream.size()); out.write(outStream.toByteArray()); }
From source file:com.mongodb.hadoop.input.MongoInputSplit.java
/** * Serialize the Split instance/*from w w w . j a va2s. co m*/ */ public void write(final DataOutput out) throws IOException { BSONEncoder enc = getBSONEncoder(); BSONObject spec = BasicDBObjectBuilder.start().add("uri", _mongoURI.toString()).add("key", _keyField) .add("query", _querySpec).add("field", _fieldSpec).add("sort", _sortSpec).add("limit", _limit) .add("skip", _skip).add("specialMin", _specialMin).add("specialMax", _specialMax) .add("notimeout", _notimeout).get(); byte[] buf = enc.encode(spec); out.write(buf); }
From source file:com.zjy.mongo.input.MongoInputSplit.java
public void write(final DataOutput out) throws IOException { BSONObject spec = BasicDBObjectBuilder.start().add("inputURI", getInputURI().toString()) .add("authURI", getAuthURI() != null ? getAuthURI().toString() : null) .add("keyField", getKeyField()).add("fields", getFields()).add("query", getQuery()) .add("sort", getSort()).add("min", getMin()).add("max", getMax()).add("notimeout", getNoTimeout()) .get();/*from ww w .j a v a 2 s . co m*/ byte[] buf = _bsonEncoder.encode(spec); out.write(buf); }
From source file:bobs.is.compress.sevenzip.SevenZOutputFile.java
private void writeHeader(final DataOutput header) throws IOException { header.write(NID.kHeader); header.write(NID.kMainStreamsInfo);/*from w w w. j a v a 2 s .c om*/ writeStreamsInfo(header); writeFilesInfo(header); header.write(NID.kEnd); }
From source file:bobs.is.compress.sevenzip.SevenZOutputFile.java
private void writeSubStreamsInfo(final DataOutput header) throws IOException { header.write(NID.kSubStreamsInfo); // // ww w .j av a 2s . c o m // header.write(NID.kCRC); // header.write(1); // for (final SevenZArchiveEntry entry : files) { // if (entry.getHasCrc()) { // header.writeInt(Integer.reverseBytes(entry.getCrc())); // } // } // header.write(NID.kEnd); }