1. /*
  2. * @(#)BufferManagerReadGrow.java 1.18 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 com.sun.corba.se.internal.orbutil.MinorCodes;
  9. import org.omg.CORBA.MARSHAL;
  10. import org.omg.CORBA.CompletionStatus;
  11. import com.sun.corba.se.internal.iiop.messages.FragmentMessage;
  12. import com.sun.corba.se.internal.iiop.messages.Message;
  13. public class BufferManagerReadGrow
  14. implements BufferManagerRead, MarkAndResetHandler
  15. {
  16. public void processFragment (byte[] buf, FragmentMessage header) {}
  17. public void init(Message msg) {}
  18. public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
  19. {
  20. throw new MARSHAL("underflow called with grow strategy",
  21. MinorCodes.UNEXPECTED_EOF,
  22. CompletionStatus.COMPLETED_NO);
  23. }
  24. public void cancelProcessing(int requestId) {}
  25. // Mark and reset handler -------------------------
  26. private Object streamMemento;
  27. private RestorableInputStream inputStream;
  28. private boolean markEngaged = false;
  29. public MarkAndResetHandler getMarkAndResetHandler() {
  30. return this;
  31. }
  32. public void mark(RestorableInputStream is) {
  33. markEngaged = true;
  34. inputStream = is;
  35. streamMemento = inputStream.createStreamMemento();
  36. }
  37. // This will never happen
  38. public void fragmentationOccured(ByteBufferWithInfo newFragment) {}
  39. public void reset() {
  40. if (!markEngaged)
  41. return;
  42. markEngaged = false;
  43. inputStream.restoreInternalState(streamMemento);
  44. streamMemento = null;
  45. }
  46. }