org.elite.jdcbot.framework
Class DUEntity

java.lang.Object
  extended by org.elite.jdcbot.framework.DUEntity

public class DUEntity
extends java.lang.Object

Created on 26-May-08
Download/Upload Entity.

Since:
0.7
Version:
0.2
Author:
AppleGrew

Field Summary
 java.lang.String file
          The name or TTH of the file to download.
static int FILE_TYPE
           
static int FILELIST_TYPE
           
 int fileType
           
 java.io.InputStream in
          The InputStream from which the file to be uploaded is to be read.
 long len
          The total number of bytes starting from start of the file to download.
static int NO_AUTO_FILELIST_DECOMPRESS_SETTING
           
static int NO_SETTING
          This setting is set to zero, i.e.
 java.io.OutputStream os
          The OutputStream to which the downloaded file is to be written.
 int settingFlags
          It is used to set some flags like, if you donot want the downloaded file list to be automatically decompressed by the framework then set it to NO_AUTO_FILELIST_DECOMPRESS_SETTING.
 long start
          The starting byte offset of the file from which to start download.
static int TTHL_TYPE
           
 
Constructor Summary
DUEntity()
           
DUEntity(DUEntity due)
           
DUEntity(int fileType, java.io.InputStream IN)
           
DUEntity(int fileType, java.io.OutputStream OS, int settings)
           
DUEntity(int fileType, java.lang.String file2Download, int Start, int Len, java.io.InputStream IN, int settings)
           
DUEntity(int fileType, java.lang.String file2Download, int Start, int Len, java.io.OutputStream OS, int settings)
           
 
Method Summary
 DUEntity getDummyCopy()
           
 java.lang.String getFileType()
           
 boolean isSettingSet(int flag)
           
static int prepareSettings(int... flags)
          Its only job is to accept lots of setting flags as arguments and create a single integer that represents all those settings.
 void setSetting(int flag)
           
 void unsetSetting(int flag)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_TYPE

public static final int FILE_TYPE
See Also:
Constant Field Values

FILELIST_TYPE

public static final int FILELIST_TYPE
See Also:
Constant Field Values

TTHL_TYPE

public static final int TTHL_TYPE
See Also:
Constant Field Values

NO_SETTING

public static final int NO_SETTING
This setting is set to zero, i.e. it sets and means nothing. This has been given so that while supplying value for settings you need not supply 0 when you donot want to set anything.

See Also:
Constant Field Values

NO_AUTO_FILELIST_DECOMPRESS_SETTING

public static final int NO_AUTO_FILELIST_DECOMPRESS_SETTING
See Also:
Constant Field Values

file

public java.lang.String file
The name or TTH of the file to download.


os

public java.io.OutputStream os
The OutputStream to which the downloaded file is to be written.


in

public java.io.InputStream in
The InputStream from which the file to be uploaded is to be read.


start

public long start
The starting byte offset of the file from which to start download. Usually this will be 0.


len

public long len
The total number of bytes starting from start of the file to download. This will be -1 for file lists.


fileType

public int fileType

settingFlags

public int settingFlags
It is used to set some flags like, if you donot want the downloaded file list to be automatically decompressed by the framework then set it to NO_AUTO_FILELIST_DECOMPRESS_SETTING. Multiple settings should be ORed together. Better use setSetting to set the setting and unsetSetting to unset an already set setting.

Constructor Detail

DUEntity

public DUEntity()

DUEntity

public DUEntity(int fileType,
                java.lang.String file2Download,
                int Start,
                int Len,
                java.io.OutputStream OS,
                int settings)

DUEntity

public DUEntity(int fileType,
                java.io.OutputStream OS,
                int settings)

DUEntity

public DUEntity(int fileType,
                java.lang.String file2Download,
                int Start,
                int Len,
                java.io.InputStream IN,
                int settings)

DUEntity

public DUEntity(int fileType,
                java.io.InputStream IN)

DUEntity

public DUEntity(DUEntity due)
Method Detail

getDummyCopy

public DUEntity getDummyCopy()

getFileType

public java.lang.String getFileType()

setSetting

public void setSetting(int flag)

unsetSetting

public void unsetSetting(int flag)

isSettingSet

public boolean isSettingSet(int flag)

prepareSettings

public static int prepareSettings(int... flags)
Its only job is to accept lots of setting flags as arguments and create a single integer that represents all those settings. Note, that it doesn't set settingFlags at all, it will simply return the combined setting flags. You can pass the output of this method to isSettingSet to check for multiple settings at one call, or pass this value to constructors.

Parameters:
flags - The settings as arguments.
Returns:
The settings ORed together.