Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8067885

Review java.io.PushbackInputStream spec

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • 9
    • core-libs
    • None

      Currently the javadoc seems to be in an inconsistent state with the current
      code. For example:

      1. * A <code>PushbackInputStream</code> adds
          * functionality to another input stream, namely
          * the ability to "push back" or "unread"
          * one byte.

      Starting from version 1.12 it supports unreading of more than a single byte,
      providing 'unread(byte[])' and 'unread(byte[], int, int)' methods.

      2. * there is no pushed-back byte (the field
          * <code>pushBack</code> is initialized to
          * <code>-1</code>).

      Starting from 1.12, PushbackInputStream doesn't have 'int pushBack' field.
      It's been changed to 'byte[] buf'.

      3. * Pushes back a byte by copying it to the front of the pushback buffer.
          * After this method returns, the next byte to be read will have the value
          * <code>(byte)b</code>.
          
      If I'm not mistaken the next value to be read will be 'b & 0xff'. It's a bit
      fuzzy here, since we read an 'int' back rather than 'byte'.
          
      4. * <p> The method <code>reset</code> for class
          * <code>PushbackInputStream</code> does nothing except throw an
          * <code>IOException</code>.
          
      This is very wordy :)
      Maybe there is something else. It's worth having a look.

            prappo Pavel Rappo (Inactive)
            prappo Pavel Rappo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: