public synchronized void close() { if ( fbr == null ) return; try { fbr.close(); } catch ( IOException e ) { throw new RuntimeException( e ); } finally { fbr = null; } }
public synchronized void close() { if ( fbr == null ) return; try { fbr.close(); } catch ( IOException e ) { throw new RuntimeException( e ); } finally { fbr = null; } }
public synchronized void close() { if ( fbr == null ) return; try { fbr.close(); } catch ( IOException e ) { throw new RuntimeException( e ); } finally { fbr = null; } }
@Override public synchronized void close() { if (fbr == null) return; try { fbr.close(); } catch (final IOException e) { throw new RuntimeException(e); } finally { fbr = null; } }
public synchronized void close() { if ( fbr == null ) return; try { fbr.close(); } catch ( IOException e ) { throw new RuntimeException( e ); } finally { fbr = null; } }
@Override public synchronized void close() { if (fbr == null) return; try { fbr.close(); } catch (final IOException e) { throw new RuntimeException(e); } finally { fbr = null; } }
public void runTermsOnly() throws IOException { final ProgressLogger pl = new ProgressLogger( LOGGER, logInterval, TimeUnit.MILLISECONDS ); final PrintWriter[] localTerms = new PrintWriter[ numIndices ]; final int numTerms[] = new int[ numIndices ]; @SuppressWarnings("resource") final FastBufferedReader terms = new FastBufferedReader( new InputStreamReader( new FileInputStream( inputBasename + DiskBasedIndex.TERMS_EXTENSION ), "UTF-8" ) ); for( int i = 0; i < numIndices; i++ ) localTerms[ i ] = new PrintWriter( new OutputStreamWriter( new FastBufferedOutputStream( new FileOutputStream( localBasename[ i ] + DiskBasedIndex.TERMS_EXTENSION ) ), "UTF-8" ) ); // The current term final MutableString currTerm = new MutableString(); pl.itemsName = "terms"; pl.logInterval = logInterval; pl.start( "Partitioning index terms..." ); int termNumber = 0, k; while( terms.readLine( currTerm ) != null ) { k = strategy.localIndex( termNumber ); // The local index for this term if ( numTerms[ k ] != strategy.localNumber( termNumber ) ) throw new IllegalStateException(); numTerms[ k ]++; currTerm.println( localTerms[ k ] ); pl.update(); termNumber++; } terms.close(); for( int i = 0; i < numIndices; i++ ) localTerms[ i ].close(); pl.done(); }
public void runTermsOnly() throws IOException { final ProgressLogger pl = new ProgressLogger( LOGGER, logInterval ); final PrintWriter[] localTerms = new PrintWriter[ numIndices ]; final int numTerms[] = new int[ numIndices ]; final FastBufferedReader terms = new FastBufferedReader( new InputStreamReader( new FileInputStream( inputBasename + DiskBasedIndex.TERMS_EXTENSION ), "UTF-8" ) ); for( int i = 0; i < numIndices; i++ ) localTerms[ i ] = new PrintWriter( new OutputStreamWriter( new FastBufferedOutputStream( new FileOutputStream( localBasename[ i ] + DiskBasedIndex.TERMS_EXTENSION ) ), "UTF-8" ) ); // The current term final MutableString currTerm = new MutableString(); pl.itemsName = "terms"; pl.logInterval = logInterval; pl.start( "Partitioning index terms..." ); int termNumber = 0, k; while( terms.readLine( currTerm ) != null ) { k = strategy.localIndex( termNumber ); // The local index for this term if ( numTerms[ k ] != strategy.localNumber( termNumber ) ) throw new IllegalStateException(); numTerms[ k ]++; currTerm.println( localTerms[ k ] ); pl.update(); termNumber++; } terms.close(); for( int i = 0; i < numIndices; i++ ) localTerms[ i ].close(); pl.done(); }
public void runTermsOnly() throws IOException { final ProgressLogger pl = new ProgressLogger( LOGGER, logInterval ); final PrintWriter[] localTerms = new PrintWriter[ numIndices ]; final int numTerms[] = new int[ numIndices ]; final FastBufferedReader terms = new FastBufferedReader( new InputStreamReader( new FileInputStream( inputBasename + DiskBasedIndex.TERMS_EXTENSION ), "UTF-8" ) ); for( int i = 0; i < numIndices; i++ ) localTerms[ i ] = new PrintWriter( new OutputStreamWriter( new FastBufferedOutputStream( new FileOutputStream( localBasename[ i ] + DiskBasedIndex.TERMS_EXTENSION ) ), "UTF-8" ) ); // The current term final MutableString currTerm = new MutableString(); pl.itemsName = "terms"; pl.logInterval = logInterval; pl.start( "Partitioning index terms..." ); int termNumber = 0, k; while( terms.readLine( currTerm ) != null ) { k = strategy.localIndex( termNumber ); // The local index for this term if ( numTerms[ k ] != strategy.localNumber( termNumber ) ) throw new IllegalStateException(); numTerms[ k ]++; currTerm.println( localTerms[ k ] ); pl.update(); termNumber++; } terms.close(); for( int i = 0; i < numIndices; i++ ) localTerms[ i ].close(); pl.done(); }
terms.close(); for( int i = 0; i < numIndices; i++ ) localTerms[ i ].close();
final MutableString content = new MutableString(), line = new MutableString(); while( content.length() < MAX_SIZE && r.readLine( line ) != null ) content.append( line ).append( '\n' ); r.close(); connection.disconnect();
public static void main( final String[] arg ) throws JSAPException, IOException, ConfigurationException, SecurityException, URISyntaxException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { final SimpleJSAP jsap = new SimpleJSAP( SubsetLexicalStrategy.class.getName(), "Builds a subset-based lexical partitioning strategy reading an UTF-8 encoded term list from standard input.", new Parameter[] { new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the index." ), new UnflaggedOption( "strategy", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename for the strategy." ) }); JSAPResult jsapResult = jsap.parse( arg ); if ( jsap.messagePrinted() ) return; final Index index = Index.getInstance( jsapResult.getString( "basename" ) ); @SuppressWarnings("resource") final FastBufferedReader reader = new FastBufferedReader( new InputStreamReader( System.in, "UTF-8" ) ); final MutableString s = new MutableString(); final IntOpenHashSet subset = new IntOpenHashSet(); while( reader.readLine( s ) != null ) { final int t = (int)index.termMap.getLong( s ); if ( t == -1 ) throw new IllegalArgumentException( "Unknown term " + s ); subset.add( t ); } reader.close(); BinIO.storeObject( new SubsetLexicalStrategy( subset ), jsapResult.getString( "strategy" ) ); }
final MutableString term = new MutableString(); while( terms.readLine( term ) != null ) list.add( term.copy() ); terms.close();
if ( posNumBits[ i ] != null ) posNumBits[ i ].close(); termReader[ i ].close();
final MutableString term = new MutableString(); while( terms.readLine( term ) != null ) list.add( term.copy() ); terms.close();
if ( posNumBits[ i ] != null ) posNumBits[ i ].close(); termReader[ i ].close();
final MutableString term = new MutableString(); while(terms.readLine(term) != null) list.add(term.copy()); terms.close();
final MutableString term = new MutableString(); while(terms.readLine(term) != null) list.add(term.copy()); terms.close();
if ( posNumBits[ i ] != null ) posNumBits[ i ].close(); termReader[ i ].close();
reader.close();