Module swim.codec
Package swim.codec

Class InputBuffer


  • public abstract class InputBuffer
    extends Input
    Non-blocking token stream buffer.
    • Constructor Detail

      • InputBuffer

        public InputBuffer()
    • Method Detail

      • empty

        public static InputBuffer empty()
        Returns an InputBuffer in the empty state.
      • empty

        public static InputBuffer empty​(InputSettings settings)
        Returns an InputBuffer in the empty state, with the given settings.
      • empty

        public static InputBuffer empty​(Object id,
                                        Mark mark)
        Returns an InputBuffer in the empty state, at the mark position of a token stream logically identified by id.
      • empty

        public static InputBuffer empty​(Object id,
                                        Mark mark,
                                        InputSettings settings)
        Returns an InputBuffer in the empty state, at the mark position of a token stream logically identified by id, with the given settings.
      • done

        public static InputBuffer done()
        Returns an InputBuffer in the done state.
      • done

        public static InputBuffer done​(InputSettings settings)
        Returns an InputBuffer in the done state, with the given settings.
      • done

        public static InputBuffer done​(Object id,
                                       Mark mark)
        Returns an InputBuffer in the done state, at the mark position of a token stream logically identified by id.
      • done

        public static InputBuffer done​(Object id,
                                       Mark mark,
                                       InputSettings settings)
        Returns an InputBuffer in the done state, at the mark position of a token stream logically identified by id, with the given settings.
      • error

        public static InputBuffer error​(Throwable error)
        Returns an InputBuffer in the error state, with the given input error.
      • error

        public static InputBuffer error​(Throwable error,
                                        InputSettings settings)
        Returns an InputBuffer in the error state, with the given input error and settings.
      • error

        public static InputBuffer error​(Throwable error,
                                        Object id,
                                        Mark mark)
        Returns an InputBuffer in the error state, with the given input error, at the mark position of a token stream logically identified by id.
      • error

        public static InputBuffer error​(Throwable error,
                                        Object id,
                                        Mark mark,
                                        InputSettings settings)
        Returns an InputBuffer in the error state, with the given input error, at the mark position of a token stream logically identified by id, with the given settings.
      • isPart

        public abstract InputBuffer isPart​(boolean isPart)
        Description copied from class: Input
        Returns a partial Input equivalent to this Input, if isPart is true; returns a final Input equivalent to this Input if isPart is false. The caller's reference to this Input should be replaced by the returned Input.
        Specified by:
        isPart in class Input
      • index

        public abstract int index()
      • index

        public abstract InputBuffer index​(int index)
      • limit

        public abstract int limit()
      • limit

        public abstract InputBuffer limit​(int limit)
      • capacity

        public abstract int capacity()
      • remaining

        public abstract int remaining()
      • array

        public abstract byte[] array()
      • arrayOffset

        public abstract int arrayOffset()
      • has

        public abstract boolean has​(int index)
      • get

        public abstract int get​(int index)
      • set

        public abstract void set​(int index,
                                 int token)
      • step

        public abstract InputBuffer step()
        Description copied from class: Input
        Returns an Input equivalent to this Input, but advanced to the next token. Returns an Input in the error state if this Input is not in the cont state. The caller's reference to this Input should be replaced by the returned Input.
        Specified by:
        step in class Input
      • step

        public abstract InputBuffer step​(int offset)
      • seek

        public abstract InputBuffer seek​(Mark mark)
        Description copied from class: Input
        Returns an Input equivalent to this Input, but repositioned to the given mark. Returns an Input in the error state if this Input does not support seeking, or if this Input is unable to reposition to the given mark. The caller's reference to this Input should be replaced by the returned Input.
        Specified by:
        seek in class Input
      • fork

        public InputBuffer fork​(Object condition)
        Description copied from class: Input
        Returns an Input equivalent to this Input, but whose behavior may be altered by the given out-of-band condition. The caller's reference to this Input should be replaced by the returned Input.
        Overrides:
        fork in class Input
      • id

        public abstract InputBuffer id​(Object id)
        Description copied from class: Input
        Returns an Input equivalent to this Input, but logically identified by the given–possibly nullid. The caller's reference to this Input should be replaced by the returned Input.
        Specified by:
        id in class Input
      • mark

        public abstract InputBuffer mark​(Mark mark)
        Description copied from class: Input
        Returns an Input equivalent to this Input, but logically positioned at the given mark. The physical position in the input stream is not modified. The caller's reference to this Input should be replaced by the returned Input.
        Specified by:
        mark in class Input
      • settings

        public abstract InputBuffer settings​(InputSettings settings)
        Description copied from class: Input
        Returns an Input equivalent to this Input, but with the given input settings. The caller's reference to this Input should be replaced by the returned Input.
        Specified by:
        settings in class Input
      • clone

        public abstract InputBuffer clone()
        Description copied from class: Input
        Returns an independently positioned view into the token stream, initialized with identical state to this Input.
        Specified by:
        clone in class Input