public virtual void writeCompressed(ExtendedDataOutput output) { int dataType = (int)this.getDataType(); int unitLength = getUnitLength(this.getDataType()); int elementCount = this.rows(); int maxCompressedLength = this.rows() * sizeof(long) * 8 * 2 + 64 * 3; ByteBuffer outBuffer = ByteBuffer.Allocate(Math.Max(maxCompressedLength, 65536)); outBuffer.order(output.GetType() == typeof(LittleEndianDataOutputStream)); short flag = (short)((short)DATA_FORM.DF_VECTOR << 8 | (short)DATA_TYPE.DT_COMPRESS & 0xff); outBuffer.WriteShort(flag); outBuffer.WriteInt(0); // compressedBytes outBuffer.WriteInt(1); // cols outBuffer.WriteByte((byte)0); // version outBuffer.WriteByte((byte)1); // flag bit0:littleEndian bit1:containChecksum outBuffer.WriteByte(unchecked ((byte)-1)); // charcode outBuffer.WriteByte((byte)compressedMethod); outBuffer.WriteByte((byte)dataType); outBuffer.WriteByte((byte)unitLength); outBuffer.WriteByte((byte)0); outBuffer.WriteByte((byte)0); outBuffer.WriteInt(-1); //extra outBuffer.WriteInt(elementCount); outBuffer.WriteInt(-1); //TODO: checkSum EncoderFactory.Get(compressedMethod).compress(this, elementCount, unitLength, maxCompressedLength, outBuffer); int compressedLength = outBuffer.ReadableBytes - 10; outBuffer.PutInt(compressedLength, 2); byte[] tmp = new byte[outBuffer.ReadableBytes]; output.write(outBuffer.ToArray()); }
public virtual void write(ExtendedDataOutput output) { int length = 27 + AbstractExtendedDataOutputStream.getUTFlength(path, 0, 0) + sites.Count; foreach (string site in sites) { length += AbstractExtendedDataOutputStream.getUTFlength(site, 0, 0); } output.writeShort(length); output.writeString(path); output.write(id); output.writeInt(version); output.writeInt(size_Renamed); output.writeByte(flag); output.writeByte(sites.Count); foreach (string site in sites) { output.writeUTF(site); } }
protected internal override void writeVectorToOutputStream(ExtendedDataOutput @out) { @out.write(values); }