test_class.file: hbc-core/src/test/java/com/twitter/hbc/common/IOUtilsTest.java
test_class.identifier: IOUtilsTest
test_case.body: @Test
    public void testReadFullyPartial() throws Exception {
      String myMessage = "{this is my message}";
      byte[] bytes = myMessage.getBytes(Charsets.UTF_8);
  
      InputStream stream = new ByteArrayInputStream(bytes);
      Reader reader = new InputStreamReader(stream);
  
      char[] partialBuffer = new char[myMessage.length()/2];
      IOUtils.readFully(reader, partialBuffer, 0);
      for (int i = 0; i < partialBuffer.length; i++) {
        assertEquals(partialBuffer[i], myMessage.charAt(i));
      }
    }
test_case.class_method_signature: IOUtilsTest.testReadFullyPartial()
test_case.full_signature: @Test public void testReadFullyPartial()
test_case.identifier: testReadFullyPartial
test_case.invocations: getBytes length readFully assertEquals charAt
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReadFullyPartial()
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)