org.xnap.plugin.opennap.util
Class OpenNapFileHelper

java.lang.Object
  extended by org.xnap.plugin.opennap.util.OpenNapFileHelper

public class OpenNapFileHelper
extends java.lang.Object


Constructor Summary
OpenNapFileHelper()
           
 
Method Summary
static void append(java.io.File outFile, java.io.File inFile, long offset)
          Appends inFile to outFile starting at offset off inFile
static MetaInfoFile getSharedFile(java.lang.String filename)
          Retrieves repository file.
static MetaInfoFile getSharedFileByIndex(java.lang.String request)
          Extracts index and filename from OpenNap specific shared filename and return file if it's a valid Shared entry.
static java.lang.String getShareString(int index, java.io.File file)
          Converts the system-dependent pathname to the OpenNap format which uses '\' as separator.
static boolean isShared(java.io.File file)
           
static java.lang.String mapFilename(java.lang.String filename)
          Replaces all characters that confuse OpenNap servers in filename by non confusing characters.
static void match(java.io.File f1, java.io.File f2, int byteCount)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenNapFileHelper

public OpenNapFileHelper()
Method Detail

getShareString

public static java.lang.String getShareString(int index,
                                              java.io.File file)
Converts the system-dependent pathname to the OpenNap format which uses '\' as separator.


getSharedFileByIndex

public static MetaInfoFile getSharedFileByIndex(java.lang.String request)
Extracts index and filename from OpenNap specific shared filename and return file if it's a valid Shared entry.

Returns:
null, if filename is not part of repository

getSharedFile

public static MetaInfoFile getSharedFile(java.lang.String filename)
Retrieves repository file. First we try to retrieve the file by parsing for its repository index, if this does not work, we'll try to search for the file.


isShared

public static boolean isShared(java.io.File file)
See Also:
Library.isShared(File)

mapFilename

public static java.lang.String mapFilename(java.lang.String filename)
Replaces all characters that confuse OpenNap servers in filename by non confusing characters. Used to send share messages.


append

public static void append(java.io.File outFile,
                          java.io.File inFile,
                          long offset)
                   throws java.io.IOException
Appends inFile to outFile starting at offset off inFile

Throws:
java.io.IOException

match

public static void match(java.io.File f1,
                         java.io.File f2,
                         int byteCount)
                  throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2001-2005 XNap Team. All Rights Reserved.