private static void transferFrom(FileChannel channel,InputStream in) throws IOException {
  ReadableByteChannel readChannel=Channels.newChannel(in);
  if (!BROKEN_NIO) {
    channel.transferFrom(readChannel,0,MAX_EMPTYDB_SIZE);
  }
 else {
    ByteBuffer bb=ByteBuffer.allocate(8096);
    while (readChannel.read(bb) >= 0) {
      bb.flip();
      channel.write(bb);
      bb.clear();
    }
  }
}

private static void transferFrom ( FileChannel channel , InputStream in ) throws IOException { ReadableByteChannel readChannel = Channels . newChannel ( in ) ; if ( ! BROKEN_NIO ) { channel . transferFrom ( readChannel , 0 , MAX_EMPTYDB_SIZE ) ; } else { ByteBuffer bb = ByteBuffer . allocate ( 8096 ) ; while ( readChannel . read ( bb ) >= 0 ) { bb . flip ( ) ; channel . write ( bb ) ; bb . clear ( ) ; } } }
copies the given inputstream to the given channel using the most efficient means possible .
