test_class.file: hbc-core/src/test/java/com/twitter/hbc/common/IOUtilsTest.java
test_class.identifier: IOUtilsTest
test_case.body: @Test
    public void testEmptyReadFully() throws Exception {
      Reader reader = mock(Reader.class);
  
      when(reader.read(any(char[].class), anyInt(), anyInt()))
              .thenReturn(-1);
  
      char[] buffer = new char[10];
  
      try {
        IOUtils.readFully(reader, buffer, 0);
        fail();
      } catch (IOException e) {
        // expected
      }
    }
test_case.class_method_signature: IOUtilsTest.testEmptyReadFully()
test_case.full_signature: @Test public void testEmptyReadFully()
test_case.identifier: testEmptyReadFully
test_case.invocations: mock thenReturn when read any anyInt anyInt readFully fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEmptyReadFully()
focal_class.file: hbc-core/src/main/java/com/twitter/hbc/common/IOUtils.java
focal_class.identifier: IOUtils
focal_class.class_method_signature: IOUtils.readFully(Reader reader, char[] buffer, int offset)
focal_class.full_signature: public static void readFully(Reader reader, char[] buffer, int offset)
focal_class.identifier: readFully
focal_class.modifiers: public static
focal_class.parameters: (Reader reader, char[] buffer, int offset)
focal_class.return: void
focal_class.signature: void readFully(Reader reader, char[] buffer, int offset)
focal_method.body: public static void readFully(Reader reader, char[] buffer, int offset) throws IOException {
      int originalOffset = offset;
      int expected = buffer.length - offset;
      while (offset < buffer.length) {
        int numRead = reader.read(buffer, offset, buffer.length - offset);
        if (numRead < 0) {
          throw new IOException(
                  String.format("Reached end of stream earlier than expected. Expected to read %d bytes. Actual: %d",
                  expected, offset - originalOffset));
        }
        offset += numRead;
      }
    }
focal_method.class_method_signature: IOUtils.readFully(Reader reader, char[] buffer, int offset)
focal_method.full_signature: public static void readFully(Reader reader, char[] buffer, int offset)
focal_method.identifier: readFully
focal_method.invocations: read format
focal_method.modifiers: public static
focal_method.parameters: (Reader reader, char[] buffer, int offset)
focal_method.return: void
focal_method.signature: void readFully(Reader reader, char[] buffer, int offset)