public override System.Object Clone() { MultiMMapIndexInput clone = (MultiMMapIndexInput)base.Clone(); // clone.buffers = new ByteBuffer[buffers.length]; // {{Aroush-1.9}} // No need to clone bufSizes. // Since most clones will use only one buffer, duplicate() could also be // done lazy in clones, eg. when adapting curBuf. for (int bufNr = 0; bufNr < buffers.Length; bufNr++) { // clone.buffers[bufNr] = buffers[bufNr].duplicate(); // {{Aroush-1.9}} } try { clone.Seek(GetFilePointer()); } catch (System.IO.IOException ioe) { throw new System.Exception(ioe.ToString()); // {{Aroush-1.9}} should be re-thrown as RuntimeException } return(clone); }
public override object Clone() { MultiMMapIndexInput clone = (MultiMMapIndexInput)base.Clone(); clone.buffers = new System.IO.MemoryStream[buffers.Length]; // No need to clone bufSizes. // Since most clones will use only one buffer, duplicate() could also be // done lazy in clones, eg. when adapting curBuf. for (int bufNr = 0; bufNr < buffers.Length; bufNr++) { clone.buffers[bufNr] = buffers[bufNr]; // clone.buffers[bufNr] = buffers[bufNr].duplicate(); // {{Aroush-1.9}} how do we clone?! } try { clone.Seek(GetFilePointer()); } catch (System.IO.IOException ioe) { System.Exception newException = new System.Exception("", ioe); // {{Aroush-2.0}} This should be SystemException throw newException; } return(clone); }
public override System.Object Clone(IState state) { MultiMMapIndexInput clone = (MultiMMapIndexInput)base.Clone(state); clone.isClone = true; clone.buffers = new System.IO.MemoryStream[buffers.Length]; // No need to clone bufSizes. // Since most clones will use only one buffer, duplicate() could also be // done lazy in clones, e.g. when adapting curBuf. for (int bufNr = 0; bufNr < buffers.Length; bufNr++) { clone.buffers[bufNr] = buffers[bufNr]; // clone.buffers[bufNr] = buffers[bufNr].duplicate(); // {{Aroush-1.9}} how do we clone?! } try { clone.Seek(FilePointer(state), state); } catch (System.IO.IOException ioe) { System.SystemException newException = new System.SystemException(ioe.Message, ioe); throw newException; } return(clone); }