ObjectListInterface interface: Splices the internal container - this will however reset the
internal pointer.
3780
public function splice($offset, $length = 0, $replacement = null)
	{
		return array_splice($this->list, $offset, $length, $replacement);
	}
1059830
private void readObject(java.io.ObjectInputStream in)
        throws IOException, ClassNotFoundException
    {
        in.defaultReadObject();
        for (int c=0;c<LazyList.size(_components);c++)
        {
            Object o = LazyList.get(_components,c);
            ComponentEvent event = new ComponentEvent(this,o);
            for(int i=0;i<LazyList.size(_eventListeners);i++)
            {
                EventListener listener=(EventListener)LazyList.get(_eventListeners,i);
                if (listener instanceof ComponentListener)
                    ((ComponentListener)listener).addComponent(event);
            }
        }
    }
181307
function spliceList(list, index) {
        for (var i = index, j = i + 1, length = list.length; j < length; i += 1, j += 1) {
            list[i] = list[j];
        }

        list.pop();
    }
549437
public boolean skipPreamble()
            throws IOException {
        // First delimiter may be not preceeded with a CRLF.
        System.arraycopy(boundary, 2, boundary, 0, boundary.length - 2);
        boundaryLength = boundary.length - 2;
        try {
            // Discard all data up to the delimiter.
            discardBodyData();

            // Read boundary - if succeded, the stream contains an
            // encapsulation.
            return readBoundary();
        } catch (MalformedStreamException e) {
            return false;
        } finally {
            // Restore delimiter.
            System.arraycopy(boundary, 0, boundary, 2, boundary.length - 2);
            boundaryLength = boundary.length;
            boundary[0] = CR;
            boundary[1] = LF;
        }
    }
35471
protected void implCloseChannel() throws IOException {
        // Release and invalidate any locks that we still hold
        if (fileLockTable != null) {
            for (FileLock fl: fileLockTable.removeAll()) {
                synchronized (fl) {
                    if (fl.isValid()) {
                        nd.release(fd, fl.position(), fl.size());
                        ((FileLockImpl)fl).invalidate();
                    }
                }
            }
        }

        threads.signalAndWait();

        if (parent != null) {

            // Close the fd via the parent stream's close method.  The parent
            // will reinvoke our close method, which is defined in the
            // superclass AbstractInterruptibleChannel, but the isOpen logic in
            // that method will prevent this method from being reinvoked.
            //
            ((java.io.Closeable)parent).close();
        } else {
            nd.close(fd);
        }

    }
573878
public void removeObjectListeners(Class<?> objectClass, long objectId) {
        if (objectClass == null) {
            return;
        }
        synchronized (objectListeners) {
            Map<Long, Map<Class<? extends ObjectAttachableListener>,
                    Map<ObjectAttachableListener, ListenerManagerImpl<? extends ObjectAttachableListener>>>>
                    objects = objectListeners.get(objectClass);
            if (objects == null) {
                return;
            }
            // Remove all listeners
            objects.computeIfPresent(objectId, (id, listeners) -> {
                listeners.values().stream()
                        .flatMap(map -> map.values().stream())
                        .forEach(ListenerManagerImpl::removed);
                listeners.clear();
                return null;
            });
            // Cleanup
            if (objects.isEmpty()) {
                objectListeners.remove(objectClass);
            }
        }
    }
1319643
private InputStream spoolInputStream(ObjectReader in, long contentLen) throws IOException
   {
      byte[] buffer = new byte[0];
      byte[] tmpBuff;
      long readLen = 0;
      File sf = null;
      OutputStream sfout = null;

      try
      {
         while (true)
         {
            int needToRead = contentLen - readLen > 2048 ? 2048 : (int)(contentLen - readLen);
            tmpBuff = new byte[needToRead];

            if (needToRead == 0)
            {
               break;
            }

            in.readFully(tmpBuff);

            if (sfout != null)
            {
               sfout.write(tmpBuff);
            }
            else if (readLen + needToRead > maxBufferSize && fileCleaner != null)
            {
               sf = PrivilegedFileHelper.createTempFile("jcrvd", null, tempDir);
               sfout = PrivilegedFileHelper.fileOutputStream(sf);

               sfout.write(buffer);
               sfout.write(tmpBuff);
               buffer = null;
            }
            else
            {
               // reallocate new buffer and spool old buffer contents
               byte[] newBuffer = new byte[(int)(readLen + needToRead)];
               System.arraycopy(buffer, 0, newBuffer, 0, (int)readLen);
               System.arraycopy(tmpBuff, 0, newBuffer, (int)readLen, needToRead);
               buffer = newBuffer;
            }

            readLen += needToRead;
         }

         if (buffer != null)
         {
            return new ByteArrayInputStream(buffer);
         }
         else
         {
            return PrivilegedFileHelper.fileInputStream(sf);
         }
      }
      finally
      {
         if (sfout != null)
         {
            sfout.close();
         }

         if (sf != null)
         {
            spoolFileList.add(sf);
         }
      }
   }
890832
public boolean skipPreamble () throws IOException
  {
    // First delimiter may be not preceeded with a CRLF.
    System.arraycopy (m_aBoundary, 2, m_aBoundary, 0, m_aBoundary.length - 2);
    m_nBoundaryLength = m_aBoundary.length - 2;
    try
    {
      // Discard all data up to the delimiter.
      discardBodyData ();

      // Read boundary - if succeded, the stream contains an
      // encapsulation.
      return readBoundary ();
    }
    catch (final MultipartMalformedStreamException e)
    {
      return false;
    }
    finally
    {
      // Restore delimiter.
      System.arraycopy (m_aBoundary, 0, m_aBoundary, 2, m_aBoundary.length - 2);
      m_nBoundaryLength = m_aBoundary.length;
      m_aBoundary[0] = CR;
      m_aBoundary[1] = LF;
    }
  }
819567
@Override
    protected void classLoaderChanged()
    {
        Vector toRemove = new Vector(); // safely remove
        for ( Enumeration e = listeners.elements(); e.hasMoreElements(); )
        {
            WeakReference wr = (WeakReference)e.nextElement();
            Listener l = (Listener)wr.get();
            if ( l == null )  // garbage collected
              toRemove.add( wr );
            else
              l.classLoaderChanged();
        }
        for( Enumeration e = toRemove.elements(); e.hasMoreElements(); )
            listeners.removeElement( e.nextElement() );
    }
315059
void initAndSplit(int leadingNulls, @NonNull List<T> multiPageList,
            int trailingNulls, int positionOffset, int pageSize, @NonNull Callback callback) {

        int pageCount = (multiPageList.size() + (pageSize - 1)) / pageSize;
        for (int i = 0; i < pageCount; i++) {
            int beginInclusive = i * pageSize;
            int endExclusive = Math.min(multiPageList.size(), (i + 1) * pageSize);

            List<T> sublist = multiPageList.subList(beginInclusive, endExclusive);

            if (i == 0) {
                // Trailing nulls for first page includes other pages in multiPageList
                int initialTrailingNulls = trailingNulls + multiPageList.size() - sublist.size();
                init(leadingNulls, sublist, initialTrailingNulls, positionOffset);
            } else {
                int insertPosition = leadingNulls + beginInclusive;
                insertPage(insertPosition, sublist, null);
            }
        }
        callback.onInitialized(size());
    }
955124
void wrappingSpace(int indentLevel) throws IOException {
    if (closed) throw new IllegalStateException("closed");

    if (this.nextFlush != null) flush(nextFlush);
    column++; // Increment the column even though the space is deferred to next call to flush().
    this.nextFlush = FlushType.SPACE;
    this.indentLevel = indentLevel;
  }
681933
private void updateCurrentAndNextSectionOfBuffer(int i) {
		int next = iterators.length + i;
		timestamps[i] = timestamps[next];
		values[i] = values[next];
		if (iterators[i].hasNext()) {
			putDataPoint(next, (Entry<Long, Double>) iterators[i].next());
		} else {
			markEndTimeSeries(i);
		}
	}
288120
private void appendCauses(StringBuilder buf, Throwable thrown) {
    buf.append(thrown.toString()).append(OutputStreamLogger.NEWLINE);
    StackTraceElement[] stack = thrown.getStackTrace();
    int end = stack.length - 1;
    prune: for(; end >= 0; end--) {
      String cn = stack[end].getClassName();
      for(String pat : PRUNE) {
        if(cn.startsWith(pat)) {
          continue prune;
        }
      }
      break;
    }
    if(end <= 0) {
      end = stack.length - 1;
    }
    for(int i = 0; i <= end; i++) {
      buf.append("\tat ").append(stack[i]).append(OutputStreamLogger.NEWLINE);
    }
    if(end < stack.length - 1) {
      buf.append("\tat [...]").append(OutputStreamLogger.NEWLINE);
    }
    if(thrown.getCause() != null) {
      buf.append("Caused by: ");
      appendCauses(buf, thrown.getCause());
    }
  }
74224
private void list(Context ctx, String indent, StringBuilder buffer) throws Throwable
   {
      NamingEnumeration<Binding> bindings = ctx.listBindings("");
      while (bindings.hasMore())
      {
         Binding binding = bindings.next();

         String name = binding.getName();
         String className = binding.getClassName();
         boolean recursive = Context.class.isAssignableFrom(binding.getObject().getClass());
         boolean isLinkRef = LinkRef.class.isAssignableFrom(binding.getObject().getClass());

         buffer.append(indent + " +- " + name);
         
         if (isLinkRef)
         {
            try
            {
               Object obj = ctx.lookupLink(name);

               LinkRef link = (LinkRef) obj;
               buffer.append("[link -> ");
               buffer.append(link.getLinkName());
               buffer.append(']');
            }
            catch (Throwable t)
            {
               log.debugf(t, "Invalid LinkRef for: %s", name);
               buffer.append("invalid]");
            }
         }

         buffer.append(" (class: " + className + ")");

         buffer.append(NEW_LINE);
         
         if (recursive)
         {
            try
            {
               Object value = ctx.lookup(name);
               if (value instanceof Context)
               {
                  Context subctx = (Context) value;
                  list(subctx, indent + " |  ", buffer);
               }
               else
               {
                  buffer.append(indent + " |   NonContext: " + value);
                  buffer.append(NEW_LINE);
               }
            }
            catch (Throwable t)
            {
               buffer.append("Failed to lookup: " + name + ", errmsg=" + t.getMessage());
               buffer.append(NEW_LINE);
            }
         }
      }

      bindings.close();
   }
830236
protected synchronized void deleteFinalizedObjects ()
    {
        if (_finalizedSources != null) {
            IntBuffer idbuf = BufferUtils.createIntBuffer(_finalizedSources.length);
            idbuf.put(_finalizedSources).rewind();
            AL10.alDeleteSources(idbuf);
            _finalizedSources = null;
        }
        if (_finalizedBuffers != null) {
            IntBuffer idbuf = BufferUtils.createIntBuffer(_finalizedBuffers.length);
            idbuf.put(_finalizedBuffers).rewind();
            AL10.alDeleteBuffers(idbuf);
            _finalizedBuffers = null;
        }
    }
1186609
public static int splice(int fd, long offIn, int fdOut, long offOut, long len) throws IOException {
        int res = splice0(fd, offIn, fdOut, offOut, len);
        if (res >= 0) {
            return res;
        }
        return ioResult("splice", res, SPLICE_CONNECTION_RESET_EXCEPTION, SPLICE_CLOSED_CHANNEL_EXCEPTION);
    }
623486
private static void deeplyAppendParameter(StringBuilder sbuf, Object o,
                                              Set<Object[]> seenSet) {
        if (o == null) {
            sbuf.append("null");
            return;
        }
        Class<?> objClass = o.getClass();
        if (!objClass.isArray()) {
            if (Number.class.isAssignableFrom(objClass)) {
                // Prevent String instantiation for some number types
                if (objClass == Long.class) {
                    sbuf.append(((Long) o).longValue());
                } else if (objClass == Integer.class || objClass == Short.class || objClass == Byte.class) {
                    sbuf.append(((Number) o).intValue());
                } else if (objClass == Double.class) {
                    sbuf.append(((Double) o).doubleValue());
                } else if (objClass == Float.class) {
                    sbuf.append(((Float) o).floatValue());
                } else {
                    safeObjectAppend(sbuf, o);
                }
            } else {
                safeObjectAppend(sbuf, o);
            }
        } else {
            // check for primitive array types because they
            // unfortunately cannot be cast to Object[]
            sbuf.append('[');
            if (objClass == boolean[].class) {
                booleanArrayAppend(sbuf, (boolean[]) o);
            } else if (objClass == byte[].class) {
                byteArrayAppend(sbuf, (byte[]) o);
            } else if (objClass == char[].class) {
                charArrayAppend(sbuf, (char[]) o);
            } else if (objClass == short[].class) {
                shortArrayAppend(sbuf, (short[]) o);
            } else if (objClass == int[].class) {
                intArrayAppend(sbuf, (int[]) o);
            } else if (objClass == long[].class) {
                longArrayAppend(sbuf, (long[]) o);
            } else if (objClass == float[].class) {
                floatArrayAppend(sbuf, (float[]) o);
            } else if (objClass == double[].class) {
                doubleArrayAppend(sbuf, (double[]) o);
            } else {
                objectArrayAppend(sbuf, (Object[]) o, seenSet);
            }
            sbuf.append(']');
        }
    }