/** Returns an input stream encapsulating a nonempty array of input streams. * * <p>Note that if <code>inputStream.length</code> is 1 this method will return the only stream * that should be encapsulated. * * @param inputStream an array of input streams, that will be encapsulated. * @return an input stream encapsulating the argument streams (the only argument, if the length is 1). */ public static InputStream getStream( final InputStream[] inputStream ) { return getStream( inputStream, 0, inputStream.length ); }
/** Returns an input stream encapsulating a nonempty fragment of an array of input streams. * * @param inputStream an array of input streams, that will be encapsulated. * @param offset the first input stream that will be encapsulated. * @param length the number of input streams to be encapsulated. * @return an input stream encapsulating the argument streams (the only argument, if length is 1). */ public static InputStream getStream(final InputStream[] inputStream, final int offset, final int length) { if (length == 0) return NullInputStream.getInstance(); if (length == 1) return inputStream[offset]; return new MultipleInputStream(inputStream, offset ,length); }
/** Returns an input stream encapsulating a nonempty array of input streams. * * <p>Note that if <code>inputStream.length</code> is 1 this method will return the only stream * that should be encapsulated. * * @param inputStream an array of input streams, that will be encapsulated. * @return an input stream encapsulating the argument streams (the only argument, if the length is 1). */ public static InputStream getStream( final InputStream[] inputStream ) { return getStream( inputStream, 0, inputStream.length ); }
/** Returns an input stream encapsulating a nonempty fragment of an array of input streams. * * @param inputStream an array of input streams, that will be encapsulated. * @param offset the first input stream that will be encapsulated. * @param length the number of input streams to be encapsulated. * @return an input stream encapsulating the argument streams (the only argument, if length is 1). */ public static InputStream getStream( final InputStream[] inputStream, final int offset, final int length ) { if ( length == 0 ) return NullInputStream.getInstance(); if ( length == 1 ) return inputStream[ offset ]; return new MultipleInputStream( inputStream, offset ,length ); }
/** Returns an input stream encapsulating a nonempty array of input streams. * * <p>Note that if <code>inputStream.length</code> is 1 this method will return the only stream * that should be encapsulated. * * @param inputStream an array of input streams, that will be encapsulated. * @return an input stream encapsulating the argument streams (the only argument, if the length is 1). */ public static InputStream getStream(final InputStream[] inputStream) { return getStream(inputStream, 0, inputStream.length); }
/** Returns an input stream encapsulating a nonempty fragment of an array of input streams. * * @param inputStream an array of input streams, that will be encapsulated. * @param offset the first input stream that will be encapsulated. * @param length the number of input streams to be encapsulated. * @return an input stream encapsulating the argument streams (the only argument, if length is 1). */ public static InputStream getStream( final InputStream[] inputStream, final int offset, final int length ) { if ( length == 0 ) return NullInputStream.getInstance(); if ( length == 1 ) return inputStream[ offset ]; return new MultipleInputStream( inputStream, offset ,length ); }
private InputStream getStreamFromResultSet( final ResultSet rs, final MutableString title ) throws SQLException { final InputStream[] a = new InputStream[ rs.getMetaData().getColumnCount() - 2 ]; // -2 for id and title for( int i = 0; i < a.length; i++ ) { a[ i ] = rs.getBinaryStream( i + 3 ); if ( a[ i ] == null ) a[ i ] = NullInputStream.getInstance(); } if ( title != null ) title.replace( rs.getString( 2 ) ); return MultipleInputStream.getStream( a ); }
private InputStream getStreamFromResultSet( final ResultSet rs, final MutableString title ) throws SQLException { final InputStream[] a = new InputStream[ rs.getMetaData().getColumnCount() - 2 ]; // -2 for id and title for( int i = 0; i < a.length; i++ ) { a[ i ] = rs.getBinaryStream( i + 3 ); if ( a[ i ] == null ) a[ i ] = NullInputStream.getInstance(); } if ( title != null ) title.replace( rs.getString( 2 ) ); return MultipleInputStream.getStream( a ); }
private InputStream getStreamFromResultSet( final ResultSet rs, final MutableString title ) throws SQLException { final InputStream[] a = new InputStream[ rs.getMetaData().getColumnCount() - 2 ]; // -2 for id and title for( int i = 0; i < a.length; i++ ) { a[ i ] = rs.getBinaryStream( i + 3 ); if ( a[ i ] == null ) a[ i ] = NullInputStream.getInstance(); } if ( title != null ) title.replace( rs.getString( 2 ) ); return MultipleInputStream.getStream( a ); }
private InputStream getStreamFromResultSet( final ResultSet rs, final MutableString title ) throws SQLException { final InputStream[] a = new InputStream[ rs.getMetaData().getColumnCount() - 2 ]; // -2 for id and title for( int i = 0; i < a.length; i++ ) { a[ i ] = rs.getBinaryStream( i + 3 ); if ( a[ i ] == null ) a[ i ] = NullInputStream.getInstance(); } if ( title != null ) title.replace( rs.getString( 2 ) ); return MultipleInputStream.getStream( a ); }
public Document nextDocument() throws IOException { String line = reader.readLine(); if ( line == null ) return null; readLines++; String[] field = line.split( separator, -1 ); if ( field.length != column.length ) throw new IOException( "Line " + readLines + " has less (" + field.length + ") fields than the number of columns (" + column.length + ")." ); InputStream[] a = new InputStream[ column.length ]; // TODO: which encoding for getBytes()? for( int i = 0; i < column.length; i++ ) a[ i ] = new ByteArrayInputStream( field[ i ].getBytes() ); String title = titleColumn >= 0 ? field[ titleColumn ] : Integer.toString( readLines ); metadata.put( MetadataKeys.TITLE, title ); metadata.put( MetadataKeys.URI, Integer.toString( readLines ) ); return factory.getDocument( MultipleInputStream.getStream( a ), metadata ); } };
public Document nextDocument() throws IOException { String line = reader.readLine(); if ( line == null ) return null; readLines++; String[] field = line.split( separator ); if ( field.length != column.length ) throw new IOException( "Line " + readLines + " has less (" + field.length + ") fields than the number of columns (" + column.length + ")." ); InputStream[] a = new InputStream[ column.length ]; // TODO: which encoding for getBytes()? for( int i = 0; i < column.length; i++ ) a[ i ] = new ByteArrayInputStream( field[ i ].getBytes() ); String title = titleColumn >= 0 ? field[ titleColumn ] : Integer.toString( readLines ); metadata.put( MetadataKeys.TITLE, title ); metadata.put( MetadataKeys.URI, Integer.toString( readLines ) ); return factory.getDocument( MultipleInputStream.getStream( a ), metadata ); } };
public Document nextDocument() throws IOException { String line = reader.readLine(); if ( line == null ) return null; readLines++; String[] field = line.split( separator ); if ( field.length != column.length ) throw new IOException( "Line " + readLines + " has less (" + field.length + ") fields than the number of columns (" + column.length + ")." ); InputStream[] a = new InputStream[ column.length ]; // TODO: which encoding for getBytes()? for( int i = 0; i < column.length; i++ ) a[ i ] = new ByteArrayInputStream( field[ i ].getBytes() ); String title = titleColumn >= 0 ? field[ titleColumn ] : Integer.toString( readLines ); metadata.put( MetadataKeys.TITLE, title ); metadata.put( MetadataKeys.URI, Integer.toString( readLines ) ); return factory.getDocument( MultipleInputStream.getStream( a ), metadata ); } };
public Document nextDocument() throws IOException { String line = reader.readLine(); if ( line == null ) return null; readLines++; String[] field = line.split( separator, -1 ); if ( field.length != column.length ) throw new IOException( "Line " + readLines + " has less (" + field.length + ") fields than the number of columns (" + column.length + ")." ); InputStream[] a = new InputStream[ column.length ]; // TODO: which encoding for getBytes()? for( int i = 0; i < column.length; i++ ) a[ i ] = new ByteArrayInputStream( field[ i ].getBytes() ); String title = titleColumn >= 0 ? field[ titleColumn ] : Integer.toString( readLines ); metadata.put( MetadataKeys.TITLE, title ); metadata.put( MetadataKeys.URI, Integer.toString( readLines ) ); return factory.getDocument( MultipleInputStream.getStream( a ), metadata ); } };
public InputStream stream( final long index ) throws IOException { readDocument( index, -1, null ); FastByteArrayInputStream[] is = new FastByteArrayInputStream[ NUM_FIELDS ]; for( int i = 0; i < NUM_FIELDS; i++ ) is[ i ] = new FastByteArrayInputStream( buffer[ i ], 0, bufferSize[ i ] ); return MultipleInputStream.getStream( is ); }
public InputStream stream( final long index ) throws IOException { readDocument( index, -1, null ); FastByteArrayInputStream[] is = new FastByteArrayInputStream[ NUM_FIELDS ]; for( int i = 0; i < NUM_FIELDS; i++ ) is[ i ] = new FastByteArrayInputStream( buffer[ i ], 0, bufferSize[ i ] ); return MultipleInputStream.getStream( is ); }
public InputStream stream( final int index ) throws IOException { readDocument( index, -1, null ); FastByteArrayInputStream[] is = new FastByteArrayInputStream[ NUM_FIELDS ]; for( int i = 0; i < NUM_FIELDS; i++ ) is[ i ] = new FastByteArrayInputStream( buffer[ i ], 0, bufferSize[ i ] ); return MultipleInputStream.getStream( is ); }
public InputStream stream( final int index ) throws IOException { readDocument( index, -1, null ); FastByteArrayInputStream[] is = new FastByteArrayInputStream[ NUM_FIELDS ]; for( int i = 0; i < NUM_FIELDS; i++ ) is[ i ] = new FastByteArrayInputStream( buffer[ i ], 0, bufferSize[ i ] ); return MultipleInputStream.getStream( is ); }