test_class.file: hbc-core/src/test/java/com/twitter/hbc/common/DelimitedStreamReaderTest.java
test_class.identifier: DelimitedStreamReaderTest
test_case.body: @Test
    public void testReadMultipleHugeBuffer() throws Exception {
      String myMessage = "{msg1}\r\n";
      String myMessage2 = "{this is my message}\r\n";
      byte[] bytes = (myMessage + myMessage2).getBytes(Charsets.UTF_8);
  
      InputStream stream = new ByteArrayInputStream(bytes);
      DelimitedStreamReader r = new DelimitedStreamReader(stream, Charsets.UTF_8, myMessage.length() * 10);
  
      String msg1 = r.read(myMessage.length());
      String msg2 = r.read(myMessage2.length());
  
      assertEquals(msg1, myMessage);
      assertEquals(msg2, myMessage2);
    }
test_case.class_method_signature: DelimitedStreamReaderTest.testReadMultipleHugeBuffer()
test_case.full_signature: @Test public void testReadMultipleHugeBuffer()
test_case.identifier: testReadMultipleHugeBuffer
test_case.invocations: getBytes length read length read length assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReadMultipleHugeBuffer()
focal_class.declarator: inputStream
focal_class.modifier: private final
focal_class.original_string: private final InputStream inputStream;
focal_class.type: InputStream
focal_class.var_name: inputStream
focal_class.declarator: buffer
focal_class.modifier: private final
focal_class.original_string: private final byte[] buffer;
focal_class.type: byte[]
focal_class.var_name: buffer
focal_class.declarator: strBuffer
focal_class.modifier: private
focal_class.original_string: private byte[] strBuffer;
focal_class.type: byte[]
focal_class.var_name: strBuffer
focal_class.declarator: strBufferIndex
focal_class.modifier: private
focal_class.original_string: private int strBufferIndex;
focal_class.type: int
focal_class.var_name: strBufferIndex
focal_class.declarator: charset
focal_class.modifier: private final
focal_class.original_string: private final Charset charset;
focal_class.type: Charset
focal_class.var_name: charset
focal_class.declarator: offset
focal_class.modifier: private
focal_class.original_string: private int offset;
focal_class.type: int
focal_class.var_name: offset
focal_class.declarator: end
focal_class.modifier: private
focal_class.original_string: private int end;
focal_class.type: int
focal_class.var_name: end
focal_class.declarator: DEFAULT_READ_COUNT = 64
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_READ_COUNT = 64;
focal_class.type: int
focal_class.var_name: DEFAULT_READ_COUNT
focal_class.declarator: MAX_ALLOWABLE_BUFFER_SIZE = 500000
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_ALLOWABLE_BUFFER_SIZE = 500000;
focal_class.type: int
focal_class.var_name: MAX_ALLOWABLE_BUFFER_SIZE
focal_class.declarator: CR = 13
focal_class.modifier: private static final
focal_class.original_string: private static final byte CR = 13;
focal_class.type: byte
focal_class.var_name: CR
focal_class.declarator: LF = 10
focal_class.modifier: private static final
focal_class.original_string: private static final byte LF = 10;
focal_class.type: byte
focal_class.var_name: LF
focal_class.file: hbc-core/src/main/java/com/twitter/hbc/common/DelimitedStreamReader.java
focal_class.identifier: DelimitedStreamReader
focal_class.class_method_signature: DelimitedStreamReader.DelimitedStreamReader(InputStream stream, Charset charset, int bufferSize)
focal_class.full_signature: public  DelimitedStreamReader(InputStream stream, Charset charset, int bufferSize)
focal_class.identifier: DelimitedStreamReader
focal_class.modifiers: public
focal_class.parameters: (InputStream stream, Charset charset, int bufferSize)
focal_class.signature:  DelimitedStreamReader(InputStream stream, Charset charset, int bufferSize)
focal_class.class_method_signature: DelimitedStreamReader.readLine()
focal_class.full_signature: public String readLine()
focal_class.identifier: readLine
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String readLine()
focal_class.class_method_signature: DelimitedStreamReader.readLine(boolean trim)
focal_class.full_signature: private String readLine(boolean trim)
focal_class.identifier: readLine
focal_class.modifiers: private
focal_class.parameters: (boolean trim)
focal_class.return: String
focal_class.signature: String readLine(boolean trim)
focal_class.class_method_signature: DelimitedStreamReader.copyToStrBuffer(byte[] buffer, int offset, int length)
focal_class.full_signature: private void copyToStrBuffer(byte[] buffer, int offset, int length)
focal_class.identifier: copyToStrBuffer
focal_class.modifiers: private
focal_class.parameters: (byte[] buffer, int offset, int length)
focal_class.return: void
focal_class.signature: void copyToStrBuffer(byte[] buffer, int offset, int length)
focal_class.class_method_signature: DelimitedStreamReader.expandStrBuffer(int minLength)
focal_class.full_signature: private void expandStrBuffer(int minLength)
focal_class.identifier: expandStrBuffer
focal_class.modifiers: private
focal_class.parameters: (int minLength)
focal_class.return: void
focal_class.signature: void expandStrBuffer(int minLength)
focal_class.class_method_signature: DelimitedStreamReader.read(int numBytes)
focal_class.full_signature: public String read(int numBytes)
focal_class.identifier: read
focal_class.modifiers: public
focal_class.parameters: (int numBytes)
focal_class.return: String
focal_class.signature: String read(int numBytes)
focal_class.class_method_signature: DelimitedStreamReader.readAmountToStrBuffer(int length)
focal_class.full_signature: private void readAmountToStrBuffer(int length)
focal_class.identifier: readAmountToStrBuffer
focal_class.modifiers: private
focal_class.parameters: (int length)
focal_class.return: void
focal_class.signature: void readAmountToStrBuffer(int length)
focal_class.class_method_signature: DelimitedStreamReader.readStreamToStrBuffer(int length)
focal_class.full_signature: private int readStreamToStrBuffer(int length)
focal_class.identifier: readStreamToStrBuffer
focal_class.modifiers: private
focal_class.parameters: (int length)
focal_class.return: int
focal_class.signature: int readStreamToStrBuffer(int length)
focal_class.class_method_signature: DelimitedStreamReader.isReadBufferEmpty()
focal_class.full_signature: private boolean isReadBufferEmpty()
focal_class.identifier: isReadBufferEmpty
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isReadBufferEmpty()
focal_method.body: public String read(int numBytes) throws IOException {
      Preconditions.checkArgument(numBytes >= 0);
      Preconditions.checkArgument(numBytes <= MAX_ALLOWABLE_BUFFER_SIZE);
      int numBytesRemaining = numBytes;
      // first read whatever we need from our buffer
      if (!isReadBufferEmpty()) {
        int length = Math.min(end - offset, numBytesRemaining);
        copyToStrBuffer(buffer, offset, length);
        offset += length;
        numBytesRemaining -= length;
      }
  
      // next read the remaining chars directly into our strBuffer
      if (numBytesRemaining > 0) {
        readAmountToStrBuffer(numBytesRemaining);
      }
  
      if (strBufferIndex > 0 && strBuffer[strBufferIndex - 1] != LF) {
        // the last byte doesn't correspond to lf
        return readLine(false);
      }
  
      int strBufferLength = strBufferIndex;
      strBufferIndex = 0;
      return new String(strBuffer, 0, strBufferLength, charset);
    }
focal_method.class_method_signature: DelimitedStreamReader.read(int numBytes)
focal_method.full_signature: public String read(int numBytes)
focal_method.identifier: read
focal_method.invocations: checkArgument checkArgument isReadBufferEmpty min copyToStrBuffer readAmountToStrBuffer readLine
focal_method.modifiers: public
focal_method.parameters: (int numBytes)
focal_method.return: String
focal_method.signature: String read(int numBytes)