/** Reads the first 4 bytes of lenBuffer, which could be true length or * four letter word. * * @param k selection key * @return true if length read, otw false (wasn't really the length) * @throws IOException if buffer size exceeds maxBuffer size */ private boolean readLength(SelectionKey k) throws IOException { // Read the length, now get the buffer int len = lenBuffer.getInt(); if (!initialized && checkFourLetterWord(sk, len)) { return false; } if (len < 0 || len > BinaryInputArchive.maxBuffer) { throw new IOException("Len error " + len); } if (!isZKServerRunning()) { throw new IOException("ZooKeeperServer not running"); } incomingBuffer = ByteBuffer.allocate(len); return true; }
/** Reads the first 4 bytes of lenBuffer, which could be true length or * four letter word. * * @param k selection key * @return true if length read, otw false (wasn't really the length) * @throws IOException if buffer size exceeds maxBuffer size */ private boolean readLength(SelectionKey k) throws IOException { // Read the length, now get the buffer int len = lenBuffer.getInt(); if (!initialized && checkFourLetterWord(sk, len)) { return false; } if (len < 0 || len > BinaryInputArchive.maxBuffer) { throw new IOException("Len error " + len); } if (!isZKServerRunning()) { throw new IOException("ZooKeeperServer not running"); } incomingBuffer = ByteBuffer.allocate(len); return true; }
/** Reads the first 4 bytes of lenBuffer, which could be true length or * four letter word. * * @param k selection key * @return true if length read, otw false (wasn't really the length) * @throws IOException if buffer size exceeds maxBuffer size */ private boolean readLength(SelectionKey k) throws IOException { // Read the length, now get the buffer int len = lenBuffer.getInt(); if (!initialized && checkFourLetterWord(k, len)) { return false; } if (len < 0 || len > BinaryInputArchive.maxBuffer) { throw new IOException("Len error " + len); } if (zk == null) { throw new IOException("ZooKeeperServer not running"); } incomingBuffer = ByteBuffer.allocate(len); return true; }