List of usage examples for java.io DataOutput write
void write(byte b[]) throws IOException;
b
. From source file:com.smartitengineering.cms.api.impl.content.ContentIdImpl.java
@Override public void writeExternal(DataOutput output) throws IOException { output.write(org.apache.commons.codec.binary.StringUtils.getBytesUtf8(toString())); }
From source file:libra.common.hadoop.io.datatypes.CompressedSequenceWritable.java
@Override public void write(DataOutput out) throws IOException { out.writeByte(this.seqLength); out.write(this.compressedSequence); }
From source file:com.krawler.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);/*w w w . j a va 2s . c o 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:eu.stratosphere.types.StringValue.java
public static final void writeString(CharSequence cs, DataOutput out) throws IOException { if (cs != null) { // the length we write is offset by one, because a length of zero indicates a null value int lenToWrite = cs.length() + 1; if (lenToWrite < 0) { throw new IllegalArgumentException("CharSequence is too long."); }//from www. j a v a 2 s . c o m // write the length, variable-length encoded while (lenToWrite >= HIGH_BIT) { out.write(lenToWrite | HIGH_BIT); lenToWrite >>>= 7; } out.write(lenToWrite); // write the char data, variable length encoded for (int i = 0; i < cs.length(); i++) { int c = cs.charAt(i); while (c >= HIGH_BIT) { out.write(c | HIGH_BIT); c >>>= 7; } out.write(c); } } else { out.write(0); } }
From source file:edu.umn.cs.spatialHadoop.core.JTSShape.java
@Override public void write(DataOutput out) throws IOException { byte[] wkb = wkbWriter.write(geom); out.writeInt(wkb.length);//from w w w . j a v a 2s . c o m out.write(wkb); }
From source file:io.dstream.hadoop.TypeAwareWritable.java
/** * //from w w w. ja va 2s . c om */ @Override public void write(DataOutput out) throws IOException { out.writeByte(this.valueType); if (this.valueType != NULL) { try { out.write(this.valueEncoder.valueBytes); } catch (Exception e) { e.printStackTrace(); } } }
From source file:com.liveramp.cascading_ext.bloom.BloomFilter.java
@Override public void write(DataOutput out) throws IOException { out.writeInt(this.numHashes); out.writeLong(this.vectorSize); out.writeLong(this.numElems); out.write(this.bits.getRaw()); byte[] serializedHashFunction = SerializationUtils.serialize(this.hashFunction); out.writeInt(serializedHashFunction.length); out.write(serializedHashFunction);//from w w w . j av a 2 s.c om }
From source file:edu.umn.cs.spatialHadoop.core.OGCESRIShape.java
@Override public void write(DataOutput out) throws IOException { byte[] bytes = geom.asBinary().array(); out.writeInt(bytes.length);/*from w w w . java 2s . c om*/ out.write(bytes); }
From source file:cosmos.records.impl.MapRecord.java
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, this.docId); byte[] cvBytes = this.docVisibility.flatten(); WritableUtils.writeVInt(out, cvBytes.length); out.write(cvBytes); WritableUtils.writeVInt(out, this.document.size()); for (Entry<Column, RecordValue<?>> entry : this.document.entrySet()) { entry.getKey().write(out);/* www . ja v a2 s . c o m*/ entry.getValue().write(out); } }
From source file:com.nearinfinity.blur.mapreduce.BlurTask.java
private void writeString(DataOutput output, String s) throws IOException { byte[] bs = s.getBytes(); output.writeInt(bs.length);/* w ww. j a va 2 s . co m*/ output.write(bs); }