本文整理汇总了Java中com.aelitis.azureus.core.vuzefile.VuzeFileHandler类的典型用法代码示例。如果您正苦于以下问题:Java VuzeFileHandler类的具体用法?Java VuzeFileHandler怎么用?Java VuzeFileHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VuzeFileHandler类属于com.aelitis.azureus.core.vuzefile包,在下文中一共展示了VuzeFileHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSubscriptionFromVuzeFile
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
protected SubscriptionImpl
getSubscriptionFromVuzeFile(
byte[] sid,
int add_type,
File file )
throws SubscriptionException
{
VuzeFileHandler vfh = VuzeFileHandler.getSingleton();
String file_str = file.getAbsolutePath();
VuzeFile vf = vfh.loadVuzeFile( file_str );
if ( vf == null ){
log( "Failed to load vuze file from " + file_str );
throw( new SubscriptionException( "Failed to load vuze file from " + file_str ));
}
return( getSubscriptionFromVuzeFile( sid, add_type, vf ));
}
示例2: getSubscriptionFromVuzeFileContent
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
protected SubscriptionImpl
getSubscriptionFromVuzeFileContent(
byte[] sid,
int add_type,
String content )
throws SubscriptionException
{
VuzeFileHandler vfh = VuzeFileHandler.getSingleton();
VuzeFile vf = vfh.loadVuzeFile( Base64.decode( content ));
if ( vf == null ){
log( "Failed to load vuze file from " + content );
throw( new SubscriptionException( "Failed to load vuze file from content" ));
}
return( getSubscriptionFromVuzeFile( sid, add_type, vf ));
}
示例3: SubscriptionBodyImpl
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
protected
SubscriptionBodyImpl(
SubscriptionManagerImpl _manager,
SubscriptionImpl _subs )
throws SubscriptionException
{
manager = _manager;
try{
File vuze_file = manager.getVuzeFile( _subs );
VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile( vuze_file.getAbsolutePath());
if ( vf == null ){
throw( new IOException( "Failed to load vuze file '" + vuze_file + "'" ));
}
load( vf.getComponents()[0].getContent(), false );
}catch( Throwable e ){
rethrow( e );
}
}
示例4: main
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
public static void
main(
String[] args )
{
try{
VuzeFile vf = VuzeFileHandler.getSingleton().create();
Map contents = new HashMap();
contents.put( "type", new Long( 1 ));
contents.put( "term", "donkey" );
vf.addComponent(
VuzeFileComponent.COMP_TYPE_METASEARCH_OPERATION,
contents);
vf.write( new File( "C:\\temp\\search.vuze" ));
}catch( Throwable e ){
e.printStackTrace();
}
}
示例5: preInitialise
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
public static void
preInitialise()
{
VuzeFileHandler.getSingleton().addProcessor(
new VuzeFileProcessor()
{
public void
process(
VuzeFile[] files,
int expected_types )
{
for (int i=0;i<files.length;i++){
VuzeFile vf = files[i];
VuzeFileComponent[] comps = vf.getComponents();
for (int j=0;j<comps.length;j++){
VuzeFileComponent comp = comps[j];
if ( comp.getType() == VuzeFileComponent.COMP_TYPE_CONTENT_NETWORK ){
try{
((ContentNetworkManagerImpl)getSingleton()).importNetwork( comp.getContent());
comp.setProcessed();
}catch( Throwable e ){
log( "Failed to import from vuze file", e );
Debug.out( e );
}
}
}
}
}
});
}
示例6: exportCustomization
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
protected void
exportCustomization(
CustomizationImpl cust,
File to_file )
throws CustomizationException
{
if ( to_file.isDirectory()){
to_file = new File( to_file, cust.getName() + "_" + cust.getVersion() + ".vuze");
}
if ( !to_file.getName().endsWith( ".vuze" )){
to_file = new File( to_file.getParentFile(), to_file.getName() + ".vuze" );
}
try{
Map contents = new HashMap();
byte[] data = FileUtil.readFileAsByteArray( cust.getContents());
contents.put( "name", cust.getName());
contents.put( "version", cust.getVersion());
contents.put( "data", data );
VuzeFile vf = VuzeFileHandler.getSingleton().create();
vf.addComponent(
VuzeFileComponent.COMP_TYPE_CUSTOMIZATION,
contents);
vf.write( to_file );
}catch( Throwable e ){
throw( new CustomizationException( "Failed to export customization", e ));
}
}
示例7: getVuzeFile
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
public VuzeFile
getVuzeFile()
throws SubscriptionException
{
try{
return( VuzeFileHandler.getSingleton().loadVuzeFile( manager.getVuzeFile( this ).getAbsolutePath()));
}catch( Throwable e ){
throw( new SubscriptionException( "Failed to get Vuze file", e ));
}
}
示例8: updateSubscription
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
protected void
updateSubscription(
SubscriptionImpl subs,
File data_location )
{
log( "Updating subscription '" + subs.getString() + " using '" + data_location + "'" );
VuzeFileHandler vfh = VuzeFileHandler.getSingleton();
VuzeFile vf = vfh.loadVuzeFile( data_location.getAbsolutePath());
vfh.handleFiles( new VuzeFile[]{ vf }, VuzeFileComponent.COMP_TYPE_SUBSCRIPTION );
}
示例9: main
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
public static void
main(
String[] args )
{
final String NAME = "lalalal";
final String URL_STR = "http://www.vuze.com/feed/publisher/ALL/1";
try{
//AzureusCoreFactory.create();
/*
Subscription subs =
getSingleton(true).createSingletonRSS(
NAME,
new URL( URL_STR ),
240 );
subs.getVuzeFile().write( new File( "C:\\temp\\srss.vuze" ));
subs.remove();
*/
VuzeFile vf = VuzeFileHandler.getSingleton().create();
Map map = new HashMap();
map.put( "name", NAME );
map.put( "url", URL_STR );
map.put( "public", new Long( 0 ));
map.put( "check_interval_mins", new Long( 345 ));
vf.addComponent( VuzeFileComponent.COMP_TYPE_SUBSCRIPTION_SINGLETON, map );
vf.write( new File( "C:\\temp\\srss_2.vuze" ) );
}catch( Throwable e ){
e.printStackTrace();
}
}
示例10: exportToVuzeFile
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
public void
exportToVuzeFile(
File target )
throws IOException
{
VuzeFile vf = VuzeFileHandler.getSingleton().create();
vf.addComponent(
VuzeFileComponent.COMP_TYPE_METASEARCH_TEMPLATE,
exportToBencodedMap());
vf.write( target );
}
示例11: loadFromVuzeFile
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
public Engine[]
loadFromVuzeFile(
File file )
{
VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile( file.getAbsolutePath());
if ( vf != null ){
return( loadFromVuzeFile( vf ));
}
return( new Engine[0]);
}
示例12: connect
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
public void
connect()
throws IOException
{
String str = url.toExternalForm();
int pos = str.indexOf( "=" );
str = str.substring( pos+1 );
byte[] bytes = str.getBytes( Constants.BYTE_ENCODING );
VuzeFile vf = VuzeFileHandler.getSingleton().loadVuzeFile( bytes );
if ( vf == null ){
throw( new IOException( "Invalid vuze file" ));
}
input_stream = new ByteArrayInputStream( bytes );
}
示例13: PluginInstallerImpl
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
protected
PluginInstallerImpl(
PluginManager _manager )
{
manager = _manager;
VuzeFileHandler.getSingleton().addProcessor(
new VuzeFileProcessor()
{
public void
process(
VuzeFile[] files,
int expected_types )
{
for (int i=0;i<files.length;i++){
VuzeFile vf = files[i];
VuzeFileComponent[] comps = vf.getComponents();
for (int j=0;j<comps.length;j++){
VuzeFileComponent comp = comps[j];
if ( comp.getType() == VuzeFileComponent.COMP_TYPE_PLUGIN ){
try{
Map content = comp.getContent();
String id = new String((byte[])content.get( "id" ), "UTF-8" );
String version = new String((byte[])content.get( "version" ), "UTF-8" );
String suffix = ((Long)content.get( "is_jar" )).longValue()==1?"jar":"zip";
byte[] plugin_file = (byte[])content.get( "file" );
File temp_dir = AETemporaryFileHandler.createTempDir();
File temp_file = new File( temp_dir, id + "_" + version + "." + suffix );
FileUtil.copyFile( new ByteArrayInputStream( plugin_file ), temp_file );
FilePluginInstaller installer = installFromFile( temp_file );
addFileInstallOperation( installer );
comp.setProcessed();
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
}
}
}
});
}
示例14: getVuzeFile
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
public VuzeFile
getVuzeFile()
{
VuzeFile vf = VuzeFileHandler.getSingleton().create();
Map map = new HashMap();
try{
exportToBEncodedMap( map );
vf.addComponent( VuzeFileComponent.COMP_TYPE_CONTENT_NETWORK, map );
}catch( Throwable e ){
Debug.printStackTrace( e );
}
return( vf );
}
示例15: main
import com.aelitis.azureus.core.vuzefile.VuzeFileHandler; //导入依赖的package包/类
public static void
main(
String[] args )
{
/*
try{
CustomizationManagerImpl manager = (CustomizationManagerImpl)getSingleton();
CustomizationImpl cust = new CustomizationImpl( manager, "blah", "1.2", new File( "C:\\temp\\cust\\details.zip" ));
cust.exportToVuzeFile( new File( "C:\\temp\\cust" ));
}catch( Throwable e ){
e.printStackTrace();
}
*/
try{
VuzeFile vf = VuzeFileHandler.getSingleton().create();
Map config = new HashMap();
List list = new ArrayList();
list.add( "trout" );
list.add( 45 );
config.put( "test.a10", "Hello mum" );
config.put( "test.a11", new Long(100));
config.put( "test.a13", list );
Map map = new HashMap();
map.put( "name", "My Proxy Settings" );
map.put( "settings", config );
map.put( "restart", new Long( 1 ));
vf.addComponent( VuzeFileComponent.COMP_TYPE_CONFIG_SETTINGS, map );
vf.write( new File( "C:\\temp\\p_config.vuze" ) );
}catch( Throwable e ){
e.printStackTrace();
}
}