List of usage examples for java.io DataOutput writeUTF
void writeUTF(String s) throws IOException;
s
. From source file:parquet.hadoop.ParquetInputSplit.java
private void writeKeyValues(DataOutput out, Map<String, String> map) throws IOException { if (map == null) { out.writeInt(0);//from w ww. j a va 2 s . c o m } else { out.writeInt(map.size()); for (Entry<String, String> entry : map.entrySet()) { out.writeUTF(entry.getKey()); out.writeUTF(entry.getValue()); } } }
From source file:org.hyperic.hq.agent.AgentRemoteValue.java
private void writeChunkedValues(String key, String val, DataOutput os) throws IOException { // now chunk the values int num = 0;//from ww w. j a v a 2 s. c o m while ((num * MAX_VALUE_SIZE) < val.length()) { int start = num * MAX_VALUE_SIZE; int end = ((start + MAX_VALUE_SIZE) > val.length()) ? val.length() : start + MAX_VALUE_SIZE; String chunk = val.substring(start, end); os.writeUTF(CHUNK_PREFIX + "." + key + "." + num); os.writeUTF(chunk); num++; } }
From source file:org.apache.accumulo.core.client.mapreduce.RangeInputSplit.java
@Override public void write(DataOutput out) throws IOException { range.write(out);/*w w w. ja v a 2 s. com*/ out.writeUTF(tableName); out.writeUTF(tableId); out.writeInt(locations.length); for (int i = 0; i < locations.length; ++i) out.writeUTF(locations[i]); out.writeBoolean(null != isolatedScan); if (null != isolatedScan) { out.writeBoolean(isolatedScan); } out.writeBoolean(null != offline); if (null != offline) { out.writeBoolean(offline); } out.writeBoolean(null != localIterators); if (null != localIterators) { out.writeBoolean(localIterators); } out.writeBoolean(null != mockInstance); if (null != mockInstance) { out.writeBoolean(mockInstance); } out.writeBoolean(null != fetchedColumns); if (null != fetchedColumns) { String[] cols = InputConfigurator.serializeColumns(fetchedColumns); out.writeInt(cols.length); for (String col : cols) { out.writeUTF(col); } } out.writeBoolean(null != auths); if (null != auths) { out.writeUTF(auths.serialize()); } out.writeBoolean(null != principal); if (null != principal) { out.writeUTF(principal); } out.writeBoolean(null != tokenSource); if (null != tokenSource) { out.writeInt(tokenSource.ordinal()); if (null != token && null != tokenFile) { throw new IOException( "Cannot use both inline AuthenticationToken and file-based AuthenticationToken"); } else if (null != token) { out.writeUTF(token.getClass().getCanonicalName()); out.writeUTF(Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token))); } else { out.writeUTF(tokenFile); } } out.writeBoolean(null != instanceName); if (null != instanceName) { out.writeUTF(instanceName); } out.writeBoolean(null != zooKeepers); if (null != zooKeepers) { out.writeUTF(zooKeepers); } out.writeBoolean(null != level); if (null != level) { out.writeInt(level.toInt()); } }
From source file:org.hyperic.hq.agent.AgentRemoteValue.java
public void toStream(DataOutput os) throws IOException { for (Entry<String, String> entry : this.vals.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); // check if value is too large for writeUTF if (val.length() > MAX_VALUE_SIZE) { writeChunkedValues(key, val, os); } else {// w w w .ja v a 2 s. c om os.writeUTF(key); os.writeUTF(val); } } os.writeUTF(new String("")); }
From source file:org.apache.hadoop.hbase.HServerInfo.java
public void write(DataOutput out) throws IOException { this.serverAddress.write(out); out.writeLong(this.startCode); this.load.write(out); // Still serializing the info port for backward compatibility but it is not used. out.writeInt(HConstants.DEFAULT_REGIONSERVER_INFOPORT); out.writeUTF(hostname); if (sendSequenceIds) { HbaseMapWritable<byte[], Long> sequenceIdsWritable = new HbaseMapWritable<byte[], Long>( flushedSequenceIdByRegion); sequenceIdsWritable.write(out);//from w ww . j av a 2 s .co m } }
From source file:com.mobicage.rogerthat.registration.ContentBrandingRegistrationWizard.java
@Override public void writePickle(DataOutput out) throws IOException { T.UI();//www .j a v a 2 s.c om boolean set = mCredentials != null; out.writeBoolean(set); if (set) { out.writeInt(mCredentials.getPickleClassVersion()); mCredentials.writePickle(out); } set = mEmail != null; out.writeBoolean(set); if (set) out.writeUTF(mEmail); out.writeLong(mTimestamp); out.writeUTF(mRegistrationId); out.writeUTF(mInstallationId); out.writeUTF(mDeviceId); }
From source file:edu.umd.cloud9.collection.wikipedia.WikipediaPageOld.java
/** * Deserializes this object.// w w w.jav a 2 s. c om */ public void write(DataOutput out) throws IOException { byte[] bytes = page.getBytes("UTF-8"); WritableUtils.writeVInt(out, bytes.length); out.write(bytes, 0, bytes.length); out.writeUTF(language == null ? "unk" : language); }
From source file:parquet.hadoop.ParquetInputSplit.java
private void writeBlock(DataOutput out, BlockMetaData block) throws IOException { out.writeInt(block.getColumns().size()); for (ColumnChunkMetaData column : block.getColumns()) { writeColumn(out, column);/*from w ww .j a va2s. c om*/ } out.writeLong(block.getRowCount()); out.writeLong(block.getTotalByteSize()); out.writeBoolean(block.getPath() == null); if (block.getPath() != null) { out.writeUTF(block.getPath()); } }
From source file:org.apache.hadoop.chukwa.analysis.salsa.fsm.FSMIntermedEntry.java
public void write(DataOutput out) throws IOException { Set<String> mapKeys; out.writeInt(this.state_type.val); out.writeInt(this.state_mapred.val); out.writeInt(this.state_hdfs.val); out.writeInt(this.fsm_type.val); out.writeChar(DELIM);/*w w w .j av a2 s .c o m*/ out.writeInt(state_name.length()); if (state_name.length() > 0) out.writeUTF(state_name); out.writeInt(unique_id.length()); if (unique_id.length() > 0) out.writeUTF(unique_id); out.writeInt(timestamp.length()); if (timestamp.length() > 0) out.writeUTF(timestamp); out.writeInt(time_start.length()); if (time_start.length() > 0) out.writeUTF(time_start); out.writeInt(time_end.length()); if (time_end.length() > 0) out.writeUTF(time_end); out.writeInt(host_exec.length()); if (host_exec.length() > 0) out.writeUTF(host_exec); out.writeInt(host_other.length()); if (host_other.length() > 0) out.writeUTF(host_other); out.writeInt(time_orig_epoch.length()); if (time_orig_epoch.length() > 0) out.writeUTF(time_orig_epoch); out.writeInt(time_orig.length()); if (time_orig.length() > 0) out.writeUTF(time_orig); out.writeInt(job_id.length()); if (job_id.length() > 0) out.writeUTF(job_id); out.writeInt(identifier.length()); if (identifier.length() > 0) out.writeUTF(identifier); mapKeys = this.add_info.keySet(); out.writeInt(mapKeys.size()); for (Entry<String, String> entry : this.add_info.entrySet()) { String value = entry.getValue(); if (value.length() > 0) { out.writeUTF(entry.getKey()); out.writeInt(value.length()); out.writeUTF(value); } else { out.writeUTF("NULL"); out.writeInt(0); } } }
From source file:com.mobicage.rogerthat.registration.RegistrationWizard2.java
@SuppressWarnings("unchecked") @Override/*from ww w . j a v a 2 s .c o m*/ public void writePickle(DataOutput out) throws IOException { T.UI(); super.writePickle(out); boolean set = mCredentials != null; out.writeBoolean(set); if (set) { out.writeInt(mCredentials.getPickleClassVersion()); mCredentials.writePickle(out); } set = mEmail != null; out.writeBoolean(set); if (set) out.writeUTF(mEmail); out.writeLong(mTimestamp); out.writeUTF(mRegistrationId); out.writeBoolean(mInGoogleAuthenticationProcess); out.writeUTF(mInstallationId); out.writeUTF(mDeviceId); set = mBeaconRegions != null; out.writeBoolean(set); if (set) out.writeUTF(JSONValue.toJSONString(mBeaconRegions.toJSONMap())); set = mDetectedBeacons != null; out.writeBoolean(set); if (set) { JSONArray db1 = new JSONArray(); for (String db : mDetectedBeacons) { db1.add(db); } out.writeUTF(JSONValue.toJSONString(db1)); } }