code: private static ByteArrayOutputStream sizeLine(final InputStream stream)
          throws IOException {
          State state = State.NORMAL;
          final ByteArrayOutputStream result = new ByteArrayOutputStream();
          while (state != State.END) {
              state = next(stream, state, result);
          }
          return result;
      }
docs: Extract line with chunk size from stream.
  @param stream Input stream.
  @return Line with chunk size.
  @throws IOException If fails.