private byte readChunkImpl()

in nailgun-server/src/main/java/com/facebook/nailgun/NGCommunicator.java [501:526]


  private byte readChunkImpl() throws IOException {
    int chunkLen = in.readInt();
    byte chunkType = in.readByte();

    switch (chunkType) {
      case NGConstants.CHUNKTYPE_STDIN:
        LOG.log(Level.FINEST, "Got stdin chunk, len {0}", chunkLen);
        InputStream chunkStream = readPayload(in, chunkLen);
        setInput(chunkStream, chunkLen);
        break;

      case NGConstants.CHUNKTYPE_STDIN_EOF:
        LOG.log(Level.FINEST, "Got stdin closed chunk");
        setEof();
        break;

      case NGConstants.CHUNKTYPE_HEARTBEAT:
        LOG.log(Level.FINEST, "Got client heartbeat");
        break;

      default:
        LOG.log(Level.WARNING, "Unknown chunk type: {0}", (char) chunkType);
        throw new IOException("Unknown stream type: " + (char) chunkType);
    }
    return chunkType;
  }