Package org.glassfish.grizzly.memory

Examples of org.glassfish.grizzly.memory.ByteBufferArray.restore()


        final ByteBuffer byteBuffers[] = array.getArray();
        final int size = array.size();
       
        final int read = (int) socketChannel.read(byteBuffers, 0, size);

        array.restore();
        array.recycle();
       
        if (read > 0) {
            buffer.position(oldPos + read);
        }
View Full Code Here


            final ByteBuffer[] byteBuffers = array.getArray();
            final int size = array.size();

            read = (int) ((DatagramChannel) connection.getChannel()).read(byteBuffers, 0, size);

            array.restore();
            array.recycle();
        } else {
            read = ((DatagramChannel) connection.getChannel()).read(
                    buffer.toByteBuffer());
        }
View Full Code Here

                    final ByteBuffer[] byteBuffers = array.getArray();
                    final int size = array.size();

                    written = ((DatagramChannel) connection.getChannel()).write(byteBuffers, 0, size);

                    array.restore();
                    array.recycle();
                } else {
                    written = ((DatagramChannel) connection.getChannel()).write(
                            buffer.toByteBuffer());
                }
View Full Code Here

                try {
                    sslEngineResult = sslEngine.unwrap(inputByteBuffer,
                            outputArray, 0, bba.size());
                } finally {
                    bba.restore();
                    bba.reset();
                }
            }
        } catch (SSLException e) {
            return new SslResult(output, e);
View Full Code Here

                } while (input.hasRemaining());
            }
           
            return output;
        } finally {
            bba.restore();
            bba.reset();
            if (result != null && result.isError()) {
                if (output != null) {
                    output.dispose();
                }
View Full Code Here

                try {
                    sslEngineResult = sslEngine.wrap(inputArray, 0, bba.size(),
                            outputByteBuffer);
                } finally {
                    bba.restore();
                    bba.reset();
                }
            }
        } catch (SSLException e) {
            return new SslResult(output, e);
View Full Code Here

                    break;
                }
            } catch (SSLException e) {
                disposeBuffers(currentTargetBuffer, targetBuffer);

                originalByteBufferArray.restore();

                throw new TransformationException(e);
            }
           
            if (originalByteBuffer.hasRemaining()) { // Keep working with the current source ByteBuffer
View Full Code Here

            }
        }
        assert !originalMessage.hasRemaining();

        if (restore) {
            originalByteBufferArray.restore();
        }
        originalByteBufferArray.recycle();
       
        if (transformationResult != null) { // transformation error case
            disposeBuffers(currentTargetBuffer, targetBuffer);
View Full Code Here

                    if (inflater.finished() || inflater.needsDictionary()) {
                        final int remainder = inflater.getRemaining();

                        final int remaining = byteBuffer.remaining();

                        byteBufferArray.restore();
                        byteBufferArray.recycle();

                        buffer.position(
                                buffer.position() + remaining - remainder);
View Full Code Here

                }
            } while (lastInflated > 0);

            final int remaining = byteBuffer.remaining();

            byteBufferArray.restore();
            byteBufferArray.recycle();

            buffer.position(buffer.position() + remaining);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.