1. /*
  2. * @(#)BufferQueue.java 1.5 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.internal.iiop;
  8. import java.util.LinkedList;
  9. import java.util.NoSuchElementException;
  10. import java.util.LinkedList;
  11. /**
  12. * Simple unsynchronized queue implementation for ByteBufferWithInfos.
  13. */
  14. class BufferQueue
  15. {
  16. private LinkedList list = new LinkedList();
  17. public void enqueue(ByteBufferWithInfo item)
  18. {
  19. list.addLast(item);
  20. }
  21. public ByteBufferWithInfo dequeue() throws NoSuchElementException
  22. {
  23. return (ByteBufferWithInfo)list.removeFirst();
  24. }
  25. public int size()
  26. {
  27. return list.size();
  28. }
  29. // Adds the given ByteBufferWithInfo to the front
  30. // of the queue.
  31. public void push(ByteBufferWithInfo item)
  32. {
  33. list.addFirst(item);
  34. }
  35. }