/// <exception cref="System.IO.IOException"/> public virtual void RunMap(InputSplit split, int numReduces, bool pipedInput) { WritableUtils.WriteVInt(stream, BinaryProtocol.MessageType.RunMap.code); WriteObject(split); WritableUtils.WriteVInt(stream, numReduces); WritableUtils.WriteVInt(stream, pipedInput ? 1 : 0); }
/// <exception cref="System.IO.IOException"/> protected internal virtual bool PositionToNextRecord(DataInput dIn) { // Sanity check if (eof) { throw new EOFException("Completed reading " + bytesRead); } // Read key and value lengths currentKeyLength = WritableUtils.ReadVInt(dIn); currentValueLength = WritableUtils.ReadVInt(dIn); bytesRead += WritableUtils.GetVIntSize(currentKeyLength) + WritableUtils.GetVIntSize (currentValueLength); // Check for EOF if (currentKeyLength == EofMarker && currentValueLength == EofMarker) { eof = true; return(false); } // Sanity check if (currentKeyLength < 0) { throw new IOException("Rec# " + recNo + ": Negative key-length: " + currentKeyLength ); } if (currentValueLength < 0) { throw new IOException("Rec# " + recNo + ": Negative value-length: " + currentValueLength ); } return(true); }
/// <exception cref="System.IO.IOException"/> public virtual void Append(DataInputBuffer key, DataInputBuffer value) { int keyLength = key.GetLength() - key.GetPosition(); if (keyLength < 0) { throw new IOException("Negative key-length not allowed: " + keyLength + " for " + key); } int valueLength = value.GetLength() - value.GetPosition(); if (valueLength < 0) { throw new IOException("Negative value-length not allowed: " + valueLength + " for " + value); } WritableUtils.WriteVInt(@out, keyLength); WritableUtils.WriteVInt(@out, valueLength); @out.Write(key.GetData(), key.GetPosition(), keyLength); @out.Write(value.GetData(), value.GetPosition(), valueLength); // Update bytes written decompressedBytesWritten += keyLength + valueLength + WritableUtils.GetVIntSize(keyLength ) + WritableUtils.GetVIntSize(valueLength); ++numRecordsWritten; }
/// <exception cref="System.IO.IOException"/> private long WriteRecords(int count, bool knownKeyLength, bool knownValueLength, bool close) { long rawDataSize = 0; for (int nx = 0; nx < count; nx++) { string key = TestTFileByteArrays.ComposeSortedKey("key", nx); DataOutputStream outKey = writer.PrepareAppendKey(knownKeyLength ? key.Length : - 1); outKey.Write(Runtime.GetBytesForString(key)); outKey.Close(); string value = "value" + nx; DataOutputStream outValue = writer.PrepareAppendValue(knownValueLength ? value.Length : -1); outValue.Write(Runtime.GetBytesForString(value)); outValue.Close(); rawDataSize += WritableUtils.GetVIntSize(Runtime.GetBytesForString(key).Length ) + Runtime.GetBytesForString(key).Length + WritableUtils.GetVIntSize(Runtime.GetBytesForString (value).Length) + Runtime.GetBytesForString(value).Length; } if (close) { CloseOutput(); } return(rawDataSize); }
/// <summary>Write the given object to the stream.</summary> /// <remarks> /// Write the given object to the stream. If it is a Text or BytesWritable, /// write it directly. Otherwise, write it to a buffer and then write the /// length and data to the stream. /// </remarks> /// <param name="obj">the object to write</param> /// <exception cref="System.IO.IOException"/> private void WriteObject(Writable obj) { // For Text and BytesWritable, encode them directly, so that they end up // in C++ as the natural translations. if (obj is Text) { Text t = (Text)obj; int len = t.GetLength(); WritableUtils.WriteVInt(stream, len); stream.Write(t.GetBytes(), 0, len); } else { if (obj is BytesWritable) { BytesWritable b = (BytesWritable)obj; int len = b.GetLength(); WritableUtils.WriteVInt(stream, len); stream.Write(b.GetBytes(), 0, len); } else { buffer.Reset(); obj.Write(buffer); int length = buffer.GetLength(); WritableUtils.WriteVInt(stream, length); stream.Write(buffer.GetData(), 0, length); } } }
/// <summary><inheritDoc/></summary> /// <exception cref="System.IO.IOException"> /// If the child InputSplit cannot be read, typically /// for faliing access checks. /// </exception> public virtual void ReadFields(DataInput @in) { // Generic array assignment int card = WritableUtils.ReadVInt(@in); if (splits == null || splits.Length != card) { splits = new InputSplit[card]; } Type[] cls = new Type[card]; try { for (int i = 0; i < card; ++i) { cls[i] = Sharpen.Runtime.GetType(Text.ReadString(@in)).AsSubclass <InputSplit>(); } for (int i_1 = 0; i_1 < card; ++i_1) { splits[i_1] = ReflectionUtils.NewInstance(cls[i_1], null); splits[i_1].ReadFields(@in); } } catch (TypeLoadException e) { throw (IOException)Sharpen.Extensions.InitCause(new IOException("Failed split init" ), e); } }
public void write(DataOutput @out) { //serialize path, offset, length using FileSplit base.write(@out); int flags = (_hasBase ? OrcSplit.BASE_FLAG : 0) | (_isOriginal ? OrcSplit.ORIGINAL_FLAG : 0) | (_hasFooter ? OrcSplit.FOOTER_FLAG : 0); @out.writeByte(flags); @out.writeInt(deltas.Count); foreach (AcidInputFormat.DeltaMetaData delta in deltas) { delta.write(@out); } if (_hasFooter) { // serialize FileMetaInfo fields Text.writeString(@out, fileMetaInfo.compressionType); WritableUtils.writeVInt(@out, fileMetaInfo.bufferSize); WritableUtils.writeVInt(@out, fileMetaInfo.metadataSize); // serialize FileMetaInfo field footer ByteBuffer footerBuff = fileMetaInfo.footerBuffer; footerBuff.reset(); // write length of buffer WritableUtils.writeVInt(@out, footerBuff.limit() - footerBuff.position()); @out.write(footerBuff.array(), footerBuff.position(), footerBuff.limit() - footerBuff.position()); WritableUtils.writeVInt(@out, fileMetaInfo.writerVersion.getId()); } }
/// <exception cref="System.IO.IOException"/> public virtual void ReadFields(DataInput @in) { this.taskid.ReadFields(@in); this.progress = @in.ReadFloat(); this.state = StringInterner.WeakIntern(Text.ReadString(@in)); this.startTime = @in.ReadLong(); this.finishTime = @in.ReadLong(); diagnostics = WritableUtils.ReadStringArray(@in); counters = new Counters(); counters.ReadFields(@in); currentStatus = WritableUtils.ReadEnum <TIPStatus>(@in); if (currentStatus == TIPStatus.Running) { int num = WritableUtils.ReadVInt(@in); for (int i = 0; i < num; i++) { TaskAttemptID t = new TaskAttemptID(); t.ReadFields(@in); runningAttempts.AddItem(t); } } else { if (currentStatus == TIPStatus.Complete) { successfulAttempt.ReadFields(@in); } } }
/// <exception cref="System.IO.IOException"/> public virtual void ReadFields(BinaryReader reader) { int length = @in.ReadInt(); if (length == -1) { this.value = null; } else { if (length == 0) { this._elementType = (Type)ObjectWritable.LoadClass(_conf, WritableUtils.ReadString( @in)); this.value = EnumSet.NoneOf(this._elementType); } else { E first = (E)ObjectWritable.ReadObject(@in, _conf); this.value = (EnumSet <E>)EnumSet.Of(first); for (int i = 1; i < length; i++) { this.value.AddItem((E)ObjectWritable.ReadObject(@in, _conf)); } } } }
/// <exception cref="System.IO.IOException"/> public virtual void ReadFields(DataInput @in) { lock (this) { this.jobid = new JobID(); this.jobid.ReadFields(@in); this.setupProgress = @in.ReadFloat(); this.mapProgress = @in.ReadFloat(); this.reduceProgress = @in.ReadFloat(); this.cleanupProgress = @in.ReadFloat(); this.runState = WritableUtils.ReadEnum <JobStatus.State>(@in); this.startTime = @in.ReadLong(); this.user = StringInterner.WeakIntern(Text.ReadString(@in)); this.priority = WritableUtils.ReadEnum <JobPriority>(@in); this.schedulingInfo = StringInterner.WeakIntern(Text.ReadString(@in)); this.finishTime = @in.ReadLong(); this.isRetired = @in.ReadBoolean(); this.historyFile = StringInterner.WeakIntern(Text.ReadString(@in)); this.jobName = StringInterner.WeakIntern(Text.ReadString(@in)); this.trackingUrl = StringInterner.WeakIntern(Text.ReadString(@in)); this.jobFile = StringInterner.WeakIntern(Text.ReadString(@in)); this.isUber = @in.ReadBoolean(); // De-serialize the job's ACLs int numACLs = @in.ReadInt(); for (int i = 0; i < numACLs; i++) { JobACL aclType = WritableUtils.ReadEnum <JobACL>(@in); AccessControlList acl = new AccessControlList(" "); acl.ReadFields(@in); this.jobACLs[aclType] = acl; } } }
public override int Compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { int n1 = WritableUtils.DecodeVIntSize(b1[s1]); int n2 = WritableUtils.DecodeVIntSize(b2[s2]); IList <KeyFieldHelper.KeyDescription> allKeySpecs = keyFieldHelper.KeySpecs(); if (allKeySpecs.Count == 0) { return(CompareBytes(b1, s1 + n1, l1 - n1, b2, s2 + n2, l2 - n2)); } int[] lengthIndicesFirst = keyFieldHelper.GetWordLengths(b1, s1 + n1, s1 + l1); int[] lengthIndicesSecond = keyFieldHelper.GetWordLengths(b2, s2 + n2, s2 + l2); foreach (KeyFieldHelper.KeyDescription keySpec in allKeySpecs) { int startCharFirst = keyFieldHelper.GetStartOffset(b1, s1 + n1, s1 + l1, lengthIndicesFirst , keySpec); int endCharFirst = keyFieldHelper.GetEndOffset(b1, s1 + n1, s1 + l1, lengthIndicesFirst , keySpec); int startCharSecond = keyFieldHelper.GetStartOffset(b2, s2 + n2, s2 + l2, lengthIndicesSecond , keySpec); int endCharSecond = keyFieldHelper.GetEndOffset(b2, s2 + n2, s2 + l2, lengthIndicesSecond , keySpec); int result; if ((result = CompareByteSequence(b1, startCharFirst, endCharFirst, b2, startCharSecond , endCharSecond, keySpec)) != 0) { return(result); } } return(0); }
/////////////////////////////////////// // Writable /////////////////////////////////////// /// <exception cref="System.IO.IOException"/> public virtual void Write(DataOutput @out) { lock (this) { jobid.Write(@out); @out.WriteFloat(setupProgress); @out.WriteFloat(mapProgress); @out.WriteFloat(reduceProgress); @out.WriteFloat(cleanupProgress); WritableUtils.WriteEnum(@out, runState); @out.WriteLong(startTime); Text.WriteString(@out, user); WritableUtils.WriteEnum(@out, priority); Text.WriteString(@out, schedulingInfo); @out.WriteLong(finishTime); @out.WriteBoolean(isRetired); Text.WriteString(@out, historyFile); Text.WriteString(@out, jobName); Text.WriteString(@out, trackingUrl); Text.WriteString(@out, jobFile); @out.WriteBoolean(isUber); // Serialize the job's ACLs @out.WriteInt(jobACLs.Count); foreach (KeyValuePair <JobACL, AccessControlList> entry in jobACLs) { WritableUtils.WriteEnum(@out, entry.Key); entry.Value.Write(@out); } } }
public override int Compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { int n1 = WritableUtils.DecodeVIntSize(b1[s1]); int n2 = WritableUtils.DecodeVIntSize(b2[s2]); return(CompareBytes(b1, s1 + n1, l1 - n1, b2, s2 + n2, l2 - n2)); }
/// <exception cref="System.IO.IOException"/> protected internal virtual void ReadObject(Writable obj, DataInputStream inStream ) { int numBytes = WritableUtils.ReadVInt(inStream); byte[] buffer; // For BytesWritable and Text, use the specified length to set the length // this causes the "obvious" translations to work. So that if you emit // a string "abc" from C++, it shows up as "abc". if (obj is BytesWritable) { buffer = new byte[numBytes]; inStream.ReadFully(buffer); ((BytesWritable)obj).Set(buffer, 0, numBytes); } else { if (obj is Text) { buffer = new byte[numBytes]; inStream.ReadFully(buffer); ((Text)obj).Set(buffer); } else { obj.ReadFields(inStream); } } }
/// <exception cref="System.IO.IOException"/> public virtual void Write(DataOutput @out) { Text.WriteString(@out, mapId); WritableUtils.WriteVLong(@out, compressedLength); WritableUtils.WriteVLong(@out, uncompressedLength); WritableUtils.WriteVInt(@out, forReduce); }
/// <summary>Loads all the keys</summary> /// <param name="in"/> /// <exception cref="System.IO.IOException"/> public virtual void ReadFields(BinaryReader reader) { secretKeysMap.Clear(); tokenMap.Clear(); int size = WritableUtils.ReadVInt(@in); for (int i = 0; i < size; i++) { Text alias = new Text(); alias.ReadFields(@in); Org.Apache.Hadoop.Security.Token.Token <TokenIdentifier> t = new Org.Apache.Hadoop.Security.Token.Token <TokenIdentifier>(); t.ReadFields(@in); tokenMap[alias] = t; } size = WritableUtils.ReadVInt(@in); for (int i_1 = 0; i_1 < size; i_1++) { Text alias = new Text(); alias.ReadFields(@in); int len = WritableUtils.ReadVInt(@in); byte[] value = new byte[len]; @in.ReadFully(value); secretKeysMap[alias] = value; } }
/// <exception cref="System.IO.IOException"/> public virtual void ReadFields(DataInput @in) { mapId = WritableUtils.ReadStringSafely(@in, MaxIdLength); compressedLength = WritableUtils.ReadVLong(@in); uncompressedLength = WritableUtils.ReadVLong(@in); forReduce = WritableUtils.ReadVInt(@in); }
/// <summary>Writes the bit set to the stream.</summary> /// <remarks> /// Writes the bit set to the stream. The first 64 bit-positions of the bit /// set are written as a VLong for backwards-compatibility with older /// versions of TupleWritable. All bit-positions >= 64 are encoded as a byte /// for every 8 bit-positions. /// </remarks> /// <exception cref="System.IO.IOException"/> private static void WriteBitSet(DataOutput stream, int nbits, BitSet bitSet) { long bits = 0L; int bitSetIndex = bitSet.NextSetBit(0); for (; bitSetIndex >= 0 && bitSetIndex < long.Size; bitSetIndex = bitSet.NextSetBit (bitSetIndex + 1)) { bits |= 1L << bitSetIndex; } WritableUtils.WriteVLong(stream, bits); if (nbits > long.Size) { bits = 0L; for (int lastWordWritten = 0; bitSetIndex >= 0 && bitSetIndex < nbits; bitSetIndex = bitSet.NextSetBit(bitSetIndex + 1)) { int bitsIndex = bitSetIndex % byte.Size; int word = (bitSetIndex - long.Size) / byte.Size; if (word > lastWordWritten) { stream.WriteByte(unchecked ((byte)bits)); bits = 0L; for (lastWordWritten++; lastWordWritten < word; lastWordWritten++) { stream.WriteByte(unchecked ((byte)bits)); } } bits |= 1L << bitsIndex; } stream.WriteByte(unchecked ((byte)bits)); } }
/// <exception cref="System.IO.IOException"/> public virtual void ReadFields(DataInput @in) { numActiveTrackers = @in.ReadInt(); int numTrackerNames = @in.ReadInt(); if (numTrackerNames > 0) { for (int i = 0; i < numTrackerNames; i++) { string name = StringInterner.WeakIntern(Org.Apache.Hadoop.IO.Text.ReadString(@in) ); activeTrackers.AddItem(name); } } numBlacklistedTrackers = @in.ReadInt(); int blackListTrackerInfoSize = @in.ReadInt(); if (blackListTrackerInfoSize > 0) { for (int i = 0; i < blackListTrackerInfoSize; i++) { ClusterStatus.BlackListInfo info = new ClusterStatus.BlackListInfo(); info.ReadFields(@in); blacklistedTrackersInfo.AddItem(info); } } numExcludedNodes = @in.ReadInt(); ttExpiryInterval = @in.ReadLong(); map_tasks = @in.ReadInt(); reduce_tasks = @in.ReadInt(); max_map_tasks = @in.ReadInt(); max_reduce_tasks = @in.ReadInt(); status = WritableUtils.ReadEnum <Cluster.JobTrackerStatus>(@in); grayListedTrackers = @in.ReadInt(); }
/// <exception cref="System.IO.IOException"/> public virtual void Mark() { if (this._enclosing.GetBackupStore() == null) { this._enclosing.backupStore = new BackupStore <KEYIN, VALUEIN>(this._enclosing.conf , this._enclosing.taskid); } this._enclosing.isMarked = true; if (!this.inReset) { this._enclosing.backupStore.Reinitialize(); if (this._enclosing.currentKeyLength == -1) { // The user has not called next() for this iterator yet, so // there is no current record to mark and copy to backup store. return; } System.Diagnostics.Debug.Assert((this._enclosing.currentValueLength != -1)); int requestedSize = this._enclosing.currentKeyLength + this._enclosing.currentValueLength + WritableUtils.GetVIntSize(this._enclosing.currentKeyLength) + WritableUtils.GetVIntSize (this._enclosing.currentValueLength); DataOutputStream @out = this._enclosing.backupStore.GetOutputStream(requestedSize ); this.WriteFirstKeyValueBytes(@out); this._enclosing.backupStore.UpdateCounters(requestedSize); } else { this._enclosing.backupStore.Mark(); } }
/// <summary> /// <inheritDoc/> /// /// </summary> /// <exception cref="System.IO.IOException"/> public virtual bool Next(K key, V value) { if (jc.Flush(ivalue)) { WritableUtils.CloneInto(key, jc.Key()); WritableUtils.CloneInto(value, Emit(ivalue)); return(true); } jc.Clear(); K iterkey = CreateKey(); PriorityQueue <ComposableRecordReader <K, object> > q = GetRecordReaderQueue(); while (!q.IsEmpty()) { FillJoinCollector(iterkey); jc.Reset(iterkey); if (jc.Flush(ivalue)) { WritableUtils.CloneInto(key, jc.Key()); WritableUtils.CloneInto(value, Emit(ivalue)); return(true); } jc.Clear(); } return(false); }
/// <summary><inheritDoc/></summary> /// <exception cref="System.IO.IOException"> /// If the child InputSplit cannot be read, typically /// for failing access checks. /// </exception> public virtual void ReadFields(DataInput @in) { // Generic array assignment int card = WritableUtils.ReadVInt(@in); if (splits == null || splits.Length != card) { splits = new InputSplit[card]; } Type[] cls = new Type[card]; try { for (int i = 0; i < card; ++i) { cls[i] = Sharpen.Runtime.GetType(Text.ReadString(@in)).AsSubclass <InputSplit>(); } for (int i_1 = 0; i_1 < card; ++i_1) { splits[i_1] = ReflectionUtils.NewInstance(cls[i_1], null); SerializationFactory factory = new SerializationFactory(conf); Deserializer deserializer = factory.GetDeserializer(cls[i_1]); deserializer.Open((DataInputStream)@in); splits[i_1] = (InputSplit)deserializer.Deserialize(splits[i_1]); } } catch (TypeLoadException e) { throw new IOException("Failed split init", e); } }
/// <exception cref="System.IO.IOException"/> public virtual void Write(BinaryWriter writer) { if (this.value == null) { @out.WriteInt(-1); WritableUtils.WriteString(@out, this._elementType.FullName); } else { object[] array = Collections.ToArray(this.value); int length = array.Length; @out.WriteInt(length); if (length == 0) { if (this._elementType == null) { throw new NotSupportedException("Unable to serialize empty EnumSet with no element type provided." ); } WritableUtils.WriteString(@out, this._elementType.FullName); } for (int i = 0; i < length; i++) { ObjectWritable.WriteObject(@out, array[i], array[i].GetType(), _conf); } } }
////////////////////////////////////////////// // Writable ////////////////////////////////////////////// /// <exception cref="System.IO.IOException"/> public virtual void Write(DataOutput @out) { taskid.Write(@out); @out.WriteFloat(progress); Text.WriteString(@out, state); @out.WriteLong(startTime); @out.WriteLong(finishTime); WritableUtils.WriteStringArray(@out, diagnostics); counters.Write(@out); WritableUtils.WriteEnum(@out, currentStatus); if (currentStatus == TIPStatus.Running) { WritableUtils.WriteVInt(@out, runningAttempts.Count); TaskAttemptID[] t = new TaskAttemptID[0]; t = Sharpen.Collections.ToArray(runningAttempts, t); for (int i = 0; i < t.Length; i++) { t[i].Write(@out); } } else { if (currentStatus == TIPStatus.Complete) { successfulAttempt.Write(@out); } } }
public virtual int Compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { int n1; int n2; if (readLen) { n1 = WritableUtils.DecodeVIntSize(b1[s1]); n2 = WritableUtils.DecodeVIntSize(b2[s2]); } else { n1 = 0; n2 = 0; } for (int i = s1 + n1; i < l1 - n1; ++i) { NUnit.Framework.Assert.AreEqual("Invalid key at " + s1, (int)TestMapCollection.KeyWritable .keyFill, b1[i]); } for (int i_1 = s2 + n2; i_1 < l2 - n2; ++i_1) { NUnit.Framework.Assert.AreEqual("Invalid key at " + s2, (int)TestMapCollection.KeyWritable .keyFill, b2[i_1]); } return(l1 - l2); }
/// <summary>Read a UTF8 encoded string with a maximum size</summary> /// <exception cref="System.IO.IOException"/> public static string ReadString(BinaryReader reader, int maxLength) { int length = WritableUtils.ReadVIntInRange(@in, 0, maxLength); byte[] bytes = new byte[length]; @in.ReadFully(bytes, 0, length); return(Decode(bytes)); }
/// <exception cref="System.IO.IOException"/> public virtual void Close() { keySerializer.Close(); valueSerializer.Close(); WritableUtils.WriteVInt(outputStream, IFile.EofMarker); WritableUtils.WriteVInt(outputStream, IFile.EofMarker); outputStream.Close(); }
/// <exception cref="System.IO.IOException"/> public virtual void ReadFields(DataInput @in) { id = new JobID(); id.ReadFields(@in); user = new Text(); user.ReadFields(@in); jobSubmitDir = new Path(WritableUtils.ReadString(@in)); }
public virtual int Compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { int n1 = WritableUtils.DecodeVIntSize(b1[s1]); int n2 = WritableUtils.DecodeVIntSize(b2[s2]); return(-1 * WritableComparator.CompareBytes(b1, s1 + n1, l1 - n1, b2, s2 + n2, l2 - n2)); }
public virtual void BinaryProtocolStub() { try { InitSoket(); // output code WritableUtils.WriteVInt(dataOut, 50); IntWritable wt = new IntWritable(); wt.Set(123); WriteObject(wt, dataOut); WriteObject(new Text("value"), dataOut); // PARTITIONED_OUTPUT WritableUtils.WriteVInt(dataOut, 51); WritableUtils.WriteVInt(dataOut, 0); WriteObject(wt, dataOut); WriteObject(new Text("value"), dataOut); // STATUS WritableUtils.WriteVInt(dataOut, 52); Text.WriteString(dataOut, "PROGRESS"); dataOut.Flush(); // progress WritableUtils.WriteVInt(dataOut, 53); dataOut.WriteFloat(0.55f); // register counter WritableUtils.WriteVInt(dataOut, 55); // id WritableUtils.WriteVInt(dataOut, 0); Text.WriteString(dataOut, "group"); Text.WriteString(dataOut, "name"); // increment counter WritableUtils.WriteVInt(dataOut, 56); WritableUtils.WriteVInt(dataOut, 0); WritableUtils.WriteVLong(dataOut, 2); // map item int intValue = WritableUtils.ReadVInt(dataInput); System.Console.Out.WriteLine("intValue:" + intValue); IntWritable iw = new IntWritable(); ReadObject(iw, dataInput); System.Console.Out.WriteLine("key:" + iw.Get()); Text txt = new Text(); ReadObject(txt, dataInput); System.Console.Out.WriteLine("value:" + txt.ToString()); // done // end of session WritableUtils.WriteVInt(dataOut, 54); System.Console.Out.WriteLine("finish"); dataOut.Flush(); dataOut.Close(); } catch (Exception x) { Sharpen.Runtime.PrintStackTrace(x); } finally { CloseSoket(); } }