List of usage examples for java.io DataOutput writeBoolean
void writeBoolean(boolean v) throws IOException;
boolean
value to this output stream. From source file:org.apache.accumulo.core.client.mapreduce.RangeInputSplit.java
@Override public void write(DataOutput out) throws IOException { range.write(out);/*from w ww. j ava2 s . c om*/ 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.apache.carbondata.core.metadata.blocklet.BlockletInfo.java
@Override public void write(DataOutput output) throws IOException { output.writeLong(dimensionOffset);/*from ww w. j a v a2s . c om*/ output.writeLong(measureOffsets); int dsize = dimensionChunkOffsets != null ? dimensionChunkOffsets.size() : 0; output.writeShort(dsize); for (int i = 0; i < dsize; i++) { output.writeLong(dimensionChunkOffsets.get(i)); } for (int i = 0; i < dsize; i++) { output.writeInt(dimensionChunksLength.get(i)); } int mSize = measureChunkOffsets != null ? measureChunkOffsets.size() : 0; output.writeShort(mSize); for (int i = 0; i < mSize; i++) { output.writeLong(measureChunkOffsets.get(i)); } for (int i = 0; i < mSize; i++) { output.writeInt(measureChunksLength.get(i)); } writeChunkInfoForOlderVersions(output); boolean isSortedPresent = (isSorted != null); output.writeBoolean(isSortedPresent); if (isSortedPresent) { output.writeBoolean(isSorted); } if (null != getNumberOfRowsPerPage()) { output.writeShort(getNumberOfRowsPerPage().length); for (int i = 0; i < getNumberOfRowsPerPage().length; i++) { output.writeInt(getNumberOfRowsPerPage()[i]); } } }
From source file:org.apache.carbondata.core.metadata.schema.table.DataMapSchema.java
@Override public void write(DataOutput out) throws IOException { out.writeUTF(dataMapName);/*www.j a v a2 s. co m*/ out.writeUTF(providerName); boolean isRelationIdentifierExists = null != relationIdentifier; out.writeBoolean(isRelationIdentifierExists); if (isRelationIdentifierExists) { this.relationIdentifier.write(out); } boolean isChildSchemaExists = null != this.childSchema; out.writeBoolean(isChildSchemaExists); if (isChildSchemaExists) { this.childSchema.write(out); } if (properties == null) { out.writeShort(0); } else { out.writeShort(properties.size()); for (Map.Entry<String, String> entry : properties.entrySet()) { out.writeUTF(entry.getKey()); out.writeUTF(entry.getValue()); } } }
From source file:org.apache.geode.distributed.internal.StartupMessage.java
@Override public void toData(DataOutput out) throws IOException { super.toData(out); DataSerializer.writeString(this.version, out); out.writeInt(this.replyProcessorId); out.writeBoolean(this.isMcastEnabled); out.writeBoolean(this.isTcpDisabled); // Send a description of all of the DataSerializers and // Instantiators that have been registered SerializerAttributesHolder[] sahs = InternalDataSerializer.getSerializersForDistribution(); out.writeInt(sahs.length);/* ww w . j a v a 2s.c o m*/ for (int i = 0; i < sahs.length; i++) { DataSerializer.writeNonPrimitiveClassName(sahs[i].getClassName(), out); out.writeInt(sahs[i].getId()); } Object[] insts = InternalInstantiator.getInstantiatorsForSerialization(); out.writeInt(insts.length); for (int i = 0; i < insts.length; i++) { String instantiatorClassName, instantiatedClassName; int id; if (insts[i] instanceof Instantiator) { instantiatorClassName = ((Instantiator) insts[i]).getClass().getName(); instantiatedClassName = ((Instantiator) insts[i]).getInstantiatedClass().getName(); id = ((Instantiator) insts[i]).getId(); } else { instantiatorClassName = ((InstantiatorAttributesHolder) insts[i]).getInstantiatorClassName(); instantiatedClassName = ((InstantiatorAttributesHolder) insts[i]).getInstantiatedClassName(); id = ((InstantiatorAttributesHolder) insts[i]).getId(); } DataSerializer.writeNonPrimitiveClassName(instantiatorClassName, out); DataSerializer.writeNonPrimitiveClassName(instantiatedClassName, out); out.writeInt(id); } DataSerializer.writeObject(interfaces, out); out.writeInt(distributedSystemId); DataSerializer.writeString(redundancyZone, out); out.writeBoolean(enforceUniqueZone); StartupMessageData data = new StartupMessageData(); data.writeHostedLocators(this.hostedLocatorsAll); data.writeIsSharedConfigurationEnabled(this.isSharedConfigurationEnabled); data.writeMcastPort(this.mcastPort); data.writeMcastHostAddress(this.mcastHostAddress); data.writeTo(out); }
From source file:org.apache.geode.internal.InternalDataSerializer.java
/** * write a set of Long objects//from w ww .ja v a 2 s . c om * * @param set the set of Long objects * @param hasLongIDs if false, write only ints, not longs * @param out the output stream */ public static void writeSetOfLongs(Set set, boolean hasLongIDs, DataOutput out) throws IOException { if (set == null) { out.writeInt(-1); } else { out.writeInt(set.size()); out.writeBoolean(hasLongIDs); for (Object aSet : set) { Long l = (Long) aSet; if (hasLongIDs) { out.writeLong(l); } else { out.writeInt((int) l.longValue()); } } } }
From source file:org.apache.geode.internal.InternalDataSerializer.java
/** * write a set of Long objects TODO: writeListOfLongs is unused * //from w ww. j av a2 s . com * @param list the set of Long objects * @param hasLongIDs if false, write only ints, not longs * @param out the output stream */ public static void writeListOfLongs(List list, boolean hasLongIDs, DataOutput out) throws IOException { if (list == null) { out.writeInt(-1); } else { out.writeInt(list.size()); out.writeBoolean(hasLongIDs); for (Object aList : list) { Long l = (Long) aList; if (hasLongIDs) { out.writeLong(l); } else { out.writeInt((int) l.longValue()); } } } }
From source file:org.apache.geode.management.internal.configuration.messages.ConfigurationRequest.java
@Override public void toData(DataOutput out) throws IOException { out.writeBoolean(isRequestForEntireConfiguration); int size = groups.size(); out.writeInt(size);/*from www . j av a 2 s. co m*/ if (size > 0) { for (String group : groups) { out.writeUTF(group); } } out.writeInt(numAttempts); }
From source file:org.apache.giraph.ooc.DiskBackedPartitionStore.java
/** * Writes vertex data (Id, value and halted state) to stream. * * @param output The output stream//from w w w . j av a 2 s .c o m * @param vertex The vertex to serialize * @throws IOException */ private void writeVertexData(DataOutput output, Vertex<I, V, E> vertex) throws IOException { vertex.getId().write(output); vertex.getValue().write(output); output.writeBoolean(vertex.isHalted()); }
From source file:org.apache.giraph.partition.DiskBackedOnlineComputePartitionStore.java
/** * Writes vertex data (Id, Vertex Value and halted state) to stream. * /* w w w.j a v a2s . c om*/ * @param output * The output stream * @param vertex * The vertex to serialize * @throws IOException */ private void writeVertexData(DataOutput output, Vertex<I, V, E, M> vertex) throws IOException { vertex.getId().write(output); vertex.getValue().write(output); output.writeBoolean(vertex.isHalted()); }
From source file:org.apache.gora.infinispan.query.InfinispanQuery.java
@Override public void write(DataOutput out) throws IOException { super.write(out); WritableUtils.writeString(out, getSortingField()); out.writeBoolean(isAscendant); if (location != null) WritableUtils.writeString(out, location.getHostName() + ADDR_DELIMITATOR + location.getPort()); else/*from w w w . java 2 s . com*/ WritableUtils.writeString(out, ""); }