Java Code Examples for org.apache.qpid.proton.engine.Transport#END_OF_STREAM
The following examples show how to use
org.apache.qpid.proton.engine.Transport#END_OF_STREAM .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ByteBufferUtils.java From qpid-proton-j with Apache License 2.0 | 6 votes |
/** * Pours the contents of {@code source} into {@code destinationTransportInput}, calling * the TransportInput many times if necessary. If the TransportInput returns a {@link org.apache.qpid.proton.engine.TransportResult} * other than ok, data may remain in source. */ public static int pourAll(ByteBuffer source, TransportInput destinationTransportInput) throws TransportException { int capacity = destinationTransportInput.capacity(); if (capacity == Transport.END_OF_STREAM) { if (source.hasRemaining()) { throw new IllegalStateException("Destination has reached end of stream: " + destinationTransportInput); } else { return Transport.END_OF_STREAM; } } int total = source.remaining(); while(source.hasRemaining() && destinationTransportInput.capacity() > 0) { pour(source, destinationTransportInput.tail()); destinationTransportInput.process(); } return total - source.remaining(); }
Example 2
Source File: DeliveryImpl.java From qpid-proton-j with Apache License 2.0 | 6 votes |
int recv(final byte[] bytes, int offset, int size) { final int consumed; if (_dataBuffer != null && _dataBuffer.hasRemaining()) { consumed = Math.min(size, _dataBuffer.remaining()); _dataBuffer.get(bytes, offset, consumed); _dataBuffer.reclaimRead(); } else { consumed = 0; } return (_complete && consumed == 0) ? Transport.END_OF_STREAM : consumed; //TODO - Implement }
Example 3
Source File: DeliveryImpl.java From qpid-proton-j with Apache License 2.0 | 6 votes |
int recv(final WritableBuffer buffer) { final int consumed; if (_dataBuffer != null && _dataBuffer.hasRemaining()) { consumed = Math.min(buffer.remaining(), _dataBuffer.remaining()); buffer.put(_dataBuffer); _dataBuffer.reclaimRead(); } else { consumed = 0; } return (_complete && consumed == 0) ? Transport.END_OF_STREAM : consumed; }
Example 4
Source File: SaslImpl.java From qpid-proton-j with Apache License 2.0 | 6 votes |
@Override public int pending() { if (isOutputInSaslMode() || _outputBuffer.position() != 0) { fillOutputBuffer(); _head.limit(_outputBuffer.position()); if (_head_closed && _outputBuffer.position() == 0) { return Transport.END_OF_STREAM; } else { return _outputBuffer.position(); } } else { _parent.switchToNextOutput(); return _underlyingOutput.pending(); } }
Example 5
Source File: SimpleSslTransportWrapper.java From qpid-proton-j with Apache License 2.0 | 6 votes |
@Override public int pending() { try { wrapOutput(); } catch (SSLException e) { _logger.log(Level.WARNING, e.getMessage()); _head_closed = true; } _head.limit(_outputBuffer.position()); if (_head_closed && _outputBuffer.position() == 0) { return Transport.END_OF_STREAM; } return _outputBuffer.position(); }
Example 6
Source File: FrameParser.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int position() { if (_tail_closed) { return Transport.END_OF_STREAM; } return (_inputBuffer == null) ? 0 : _inputBuffer.position(); }
Example 7
Source File: TransportOutputAdaptor.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int pending() { if (_head_closed) { return Transport.END_OF_STREAM; } if(_outputBuffer == null) { init_buffers(); } _output_done = _transportOutputWriter.writeInto(_outputBuffer); _head.limit(_outputBuffer.position()); if (_outputBuffer.position() == 0 && _outputBuffer.capacity() > TransportImpl.BUFFER_RELEASE_THRESHOLD) { release_buffers(); } if (_output_done && (_outputBuffer == null || _outputBuffer.position() == 0)) { return Transport.END_OF_STREAM; } else { return _outputBuffer == null ? 0 : _outputBuffer.position(); } }
Example 8
Source File: HandshakeSniffingTransportWrapper.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int pending() { if (_head_closed) { return Transport.END_OF_STREAM; } if (isDeterminationMade()) { return _selectedTransportWrapper.pending(); } else { return 0; } }
Example 9
Source File: HandshakeSniffingTransportWrapper.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int position() { if (isDeterminationMade()) { return _selectedTransportWrapper.position(); } else { if (_tail_closed) { return Transport.END_OF_STREAM; } return _determinationBuffer.position(); } }
Example 10
Source File: HandshakeSniffingTransportWrapper.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int capacity() { if (isDeterminationMade()) { return _selectedTransportWrapper.capacity(); } else { if (_tail_closed) { return Transport.END_OF_STREAM; } return _determinationBuffer.remaining(); } }
Example 11
Source File: SslImpl.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int position() { initTransportWrapperOnFirstIO(); if (_initException == null) { return _transportWrapper.position(); } else { return Transport.END_OF_STREAM; } }
Example 12
Source File: SslImpl.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int capacity() { initTransportWrapperOnFirstIO(); if (_initException == null) { return _transportWrapper.capacity(); } else { return Transport.END_OF_STREAM; } }
Example 13
Source File: SaslImpl.java From qpid-proton-j with Apache License 2.0 | 5 votes |
private void reallyProcessInput() throws TransportException { if(isInputInSaslMode()) { if(_logger.isLoggable(Level.FINER)) { _logger.log(Level.FINER, SaslImpl.this + " about to call input."); } _frameParser.input(_inputBuffer); } if(!isInputInSaslMode()) { if(_logger.isLoggable(Level.FINER)) { _logger.log(Level.FINER, SaslImpl.this + " about to call plain input"); } if (_inputBuffer.hasRemaining()) { int bytes = pourAll(_inputBuffer, _underlyingInput); if (bytes == Transport.END_OF_STREAM) { _tail_closed = true; } if (!_inputBuffer.hasRemaining()) { _parent.switchToNextInput(); } } else { _parent.switchToNextInput(); } _underlyingInput.process(); } }
Example 14
Source File: SaslImpl.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int position() { if (_tail_closed) return Transport.END_OF_STREAM; if (isInputInSaslMode()) { return _inputBuffer.position(); } else { return _underlyingInput.position(); } }
Example 15
Source File: SaslImpl.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int capacity() { if (_tail_closed) return Transport.END_OF_STREAM; if (isInputInSaslMode()) { return _inputBuffer.remaining(); } else { return _underlyingInput.capacity(); } }
Example 16
Source File: FrameParser.java From qpid-proton-j with Apache License 2.0 | 5 votes |
@Override public int capacity() { if (_tail_closed) { return Transport.END_OF_STREAM; } else { if (_inputBuffer != null) { return _inputBuffer.remaining(); } else { return _inputBufferSize; } } }
Example 17
Source File: SimpleSslTransportWrapper.java From qpid-proton-j with Apache License 2.0 | 4 votes |
@Override public int position() { if (_tail_closed) return Transport.END_OF_STREAM; return _inputBuffer.position(); }
Example 18
Source File: SimpleSslTransportWrapper.java From qpid-proton-j with Apache License 2.0 | 4 votes |
@Override public int capacity() { if (_tail_closed) return Transport.END_OF_STREAM; return _inputBuffer.remaining(); }