List of usage examples for java.io DataOutput write
void write(byte b[]) throws IOException;
b
. From source file:org.apache.vxquery.runtime.functions.cast.CastToStringOperation.java
@Override public void convertNotation(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException { dOut.write(returnTag); dOut.write(stringp.getByteArray(), stringp.getStartOffset(), stringp.getLength()); }
From source file:org.apache.vxquery.runtime.functions.cast.CastToStringOperation.java
@Override public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException { dOut.write(returnTag); dOut.write(stringp.getByteArray(), stringp.getStartOffset(), stringp.getLength()); }
From source file:org.apache.vxquery.runtime.functions.cast.CastToStringOperation.java
private void sendStringDataOutput(DataOutput dOut) throws SystemException, IOException { dOut.write(returnTag); dOut.write((byte) ((abvsInner.getLength() >>> 8) & 0xFF)); dOut.write((byte) ((abvsInner.getLength() >>> 0) & 0xFF)); dOut.write(abvsInner.getByteArray(), abvsInner.getStartOffset(), abvsInner.getLength()); }
From source file:org.apache.vxquery.runtime.functions.index.indexCentralizer.IndexCentralizerUtil.java
/** * Prints all collections which have an index created. * @param sb : The output is stored in a sequence * @throws IOException : If writing the dataOutput generates {@link IOException} *///w ww . j av a2 s .c o m public void getAllCollections(SequenceBuilder sb) throws IOException { for (String s : collections) { StringValueBuilder svb = new StringValueBuilder(); ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); DataOutput output = abvs.getDataOutput(); output.write(ValueTag.XS_STRING_TAG); svb.write(s, output); sb.addItem(abvs); } }
From source file:org.archive.io.hdfs.HDFSWriterDocument.java
/** * Writes the fields of this object to <code>out</code>. * * @param out output object to serialize to *///from w w w. j a v a2s. com public void write(DataOutput out) throws IOException { reconstructDocument(); out.writeInt(buf.length); out.write(buf); }
From source file:org.cloudata.core.client.CellValueMatcherInfo.java
@Override public void write(DataOutput out) throws IOException { out.writeInt(this.version); int classCount = classNames.size(); out.writeInt(classCount);/*from w w w .j a va 2 s. c om*/ for (int i = 0; i < classCount; i++) { CWritableUtils.writeString(out, classNames.get(i)); byte[] classByte = classBytes.get(i); out.writeInt(classByte.length); out.write(classByte); } }
From source file:org.cloudata.core.common.io.CObjectWritable.java
/** Write a {@link CWritable}, {@link String}, primitive type, or an array of * the preceding. *//*from w ww.j a v a 2s .c o m*/ public static void writeObject(DataOutput out, Object instance, Class declaredClass, CloudataConf conf, boolean arrayComponent) throws IOException { if (instance == null) { // null instance = new NullInstance(declaredClass, conf); declaredClass = CWritable.class; arrayComponent = false; } if (!arrayComponent) { CUTF8.writeString(out, declaredClass.getName()); // always write declared //System.out.println("Write:declaredClass.getName():" + declaredClass.getName()); } if (declaredClass.isArray()) { // array int length = Array.getLength(instance); out.writeInt(length); //System.out.println("Write:length:" + length); if (declaredClass.getComponentType() == Byte.TYPE) { out.write((byte[]) instance); } else if (declaredClass.getComponentType() == ColumnValue.class) { //ColumnValue? Deserialize? ?? ? ?? ? . writeColumnValue(out, instance, declaredClass, conf, length); } else { for (int i = 0; i < length; i++) { writeObject(out, Array.get(instance, i), declaredClass.getComponentType(), conf, !declaredClass.getComponentType().isArray()); } } } else if (declaredClass == String.class) { // String CUTF8.writeString(out, (String) instance); } else if (declaredClass.isPrimitive()) { // primitive type if (declaredClass == Boolean.TYPE) { // boolean out.writeBoolean(((Boolean) instance).booleanValue()); } else if (declaredClass == Character.TYPE) { // char out.writeChar(((Character) instance).charValue()); } else if (declaredClass == Byte.TYPE) { // byte out.writeByte(((Byte) instance).byteValue()); } else if (declaredClass == Short.TYPE) { // short out.writeShort(((Short) instance).shortValue()); } else if (declaredClass == Integer.TYPE) { // int out.writeInt(((Integer) instance).intValue()); } else if (declaredClass == Long.TYPE) { // long out.writeLong(((Long) instance).longValue()); } else if (declaredClass == Float.TYPE) { // float out.writeFloat(((Float) instance).floatValue()); } else if (declaredClass == Double.TYPE) { // double out.writeDouble(((Double) instance).doubleValue()); } else if (declaredClass == Void.TYPE) { // void } else { throw new IllegalArgumentException("Not a primitive: " + declaredClass); } } else if (declaredClass.isEnum()) { // enum CUTF8.writeString(out, ((Enum) instance).name()); } else if (CWritable.class.isAssignableFrom(declaredClass)) { // Writable if (instance.getClass() == declaredClass) { out.writeShort(TYPE_SAME); // ? ?? ? ?? //System.out.println("Write:TYPE_SAME:" + TYPE_SAME); } else { out.writeShort(TYPE_DIFF); //System.out.println("Write:TYPE_DIFF:" + TYPE_DIFF); CUTF8.writeString(out, instance.getClass().getName()); //System.out.println("Write:instance.getClass().getName():" + instance.getClass().getName()); } ((CWritable) instance).write(out); //System.out.println("Write:instance value"); } else { throw new IOException("Can't write: " + instance + " as " + declaredClass); } }
From source file:org.cloudata.core.tablet.ColumnValue.java
public void write(DataOutput out) throws IOException { rowKey.write(out);/* w ww .j a v a 2 s . c o m*/ cellKey.write(out); //write operation if (deleted) { out.writeInt(Constants.DELETEED); } else { out.writeInt(Constants.INSERTED); } //write timestame out.writeLong(timestamp); //write numOfValues out.writeInt(numOfValues); //write value int valueLength = (value == null ? -1 : value.length); out.writeInt(valueLength); if (valueLength > 0) { out.write(value); } }
From source file:org.cloudata.core.tabletserver.CommitLog.java
public void write(DataOutput out) throws IOException { writeBytes = 0;/*from www .j a v a2 s. c om*/ out.writeInt(operation); writeBytes += CWritableUtils.getIntByteSize(); rowKey.write(out); writeBytes += rowKey.getByteSize(); writeBytes += CWritableUtils.writeString(out, columnName); columnKey.write(out); writeBytes += columnKey.getByteSize(); out.writeLong(timestamp); writeBytes += CWritableUtils.getLongByteSize(); out.writeInt(value == null ? -1 : value.length); writeBytes += CWritableUtils.getIntByteSize(); if (value != null) { out.write(value); writeBytes += value.length; } }
From source file:org.deephacks.confit.internal.hbase.MultiKeyValueComparisonFilter.java
@Override public void write(DataOutput output) throws IOException { WritableUtils.writeVInt(output, sid.length); output.write(sid); WritableUtils.writeVInt(output, maxResults); WritableUtils.writeVInt(output, restrictions.size()); for (QualifierRestriction restriction : restrictions) { int val = RestrictionType.valueOf(restriction).ordinal(); WritableUtils.writeVInt(output, val); restriction.write(output);/* ww w. j a v a 2 s. c o m*/ } }