/** * Reads only the header and reserves the specified space for instances. * Further instances can be read via <code>readInstance()</code>. * * @param reader the reader to use * @param capacity the capacity of the new dataset * @param batch true if reading in batch mode * @throws IOException if something goes wrong * @throws IOException if a problem occurs * @see #getStructure() * @see #readInstance(Instances) */ public ArffReader(Reader reader, int capacity, boolean batch) throws IOException { m_batchMode = batch; if (batch) { m_retainStringValues = true; } if (capacity < 0) { throw new IllegalArgumentException("Capacity has to be positive!"); } m_Tokenizer = new StreamTokenizer(reader); initTokenizer(); readHeader(capacity); initBuffers(); }
/** * Reads only the header and reserves the specified space for instances. * Further instances can be read via <code>readInstance()</code>. * * @param reader the reader to use * @param capacity the capacity of the new dataset * @param batch true if reading in batch mode * @throws IOException if something goes wrong * @throws IOException if a problem occurs * @see #getStructure() * @see #readInstance(Instances) */ public ArffReader(Reader reader, int capacity, boolean batch) throws IOException { m_batchMode = batch; if (batch) { m_retainStringValues = true; } if (capacity < 0) { throw new IllegalArgumentException("Capacity has to be positive!"); } m_Tokenizer = new StreamTokenizer(reader); initTokenizer(); readHeader(capacity); initBuffers(); }
/** * Reads the data completely from the reader. The data can be accessed via * the <code>getData()</code> method. * * @param reader the reader to use * @throws IOException if something goes wrong * @see #getData() */ public ArffReader(Reader reader) throws IOException { m_retainStringValues = true; m_batchMode = true; m_Tokenizer = new StreamTokenizer(reader); initTokenizer(); readHeader(1000); initBuffers(); Instance inst; while ((inst = readInstance(m_Data)) != null) { m_Data.add(inst); } compactify(); }
/** * Reads the data completely from the reader. The data can be accessed via * the <code>getData()</code> method. * * @param reader the reader to use * @throws IOException if something goes wrong * @see #getData() */ public ArffReader(Reader reader) throws IOException { m_retainStringValues = true; m_batchMode = true; m_Tokenizer = new StreamTokenizer(reader); initTokenizer(); readHeader(1000); initBuffers(); Instance inst; while ((inst = readInstance(m_Data)) != null) { m_Data.add(inst); } compactify(); }