Package com.biglybt.core.torrent.impl
Class TOTorrentFileImpl
- java.lang.Object
-
- com.biglybt.core.torrent.impl.TOTorrentFileImpl
-
- All Implemented Interfaces:
TOTorrentFile
public class TOTorrentFileImpl extends java.lang.Object implements TOTorrentFile
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map
additional_properties_maybe_null
private long
file_length
private int
first_piece_number
private static byte
FLAG_BEP47_PAD
private static byte
FLAG_OTHER_PAD
private static byte
FLAG_OTHER_PAD_CHECKED
private byte
flags
private TOTorrentFileHashTreeImpl
hash_tree
private int
index
private boolean
is_utf8
private int
last_piece_number
private byte[][]
path_components
private byte[][]
path_components_utf8
private byte[]
root_hash
private TOTorrentImpl
torrent
-
Constructor Summary
Constructors Modifier Constructor Description protected
TOTorrentFileImpl(TOTorrentImpl _torrent, int _index, long _torrent_offset, long _len, byte[][] _path_components)
protected
TOTorrentFileImpl(TOTorrentImpl _torrent, int _index, long _torrent_offset, long _len, byte[][] _path_components, byte[][] _path_components_utf8)
protected
TOTorrentFileImpl(TOTorrentImpl _torrent, int _index, long _torrent_offset, long _len, byte[][] _path_components, byte[][] _path_components_utf8, byte[] _v2_root_hash)
protected
TOTorrentFileImpl(TOTorrentImpl _torrent, int _index, long _torrent_offset, long _len, java.lang.String _path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkComponents()
java.util.Map
getAdditionalProperties()
int
getFirstPieceNumber()
TOTorrentFileHashTreeImpl
getHashTree()
V2 torrents only - also null for zero length filesint
getIndex()
int
getLastPieceNumber()
long
getLength()
int
getNumberOfPieces()
byte[][]
getPathComponents()
byte[][]
getPathComponentsBasic()
byte[][]
getPathComponentsUTF8()
java.lang.String
getRelativePath()
Build a relative path based on path components, usingFile.separator
byte[]
getRootHash()
TOTorrentImpl
getTorrent()
boolean
isPadFile()
is BEP_47 pad fileprotected boolean
isUTF8()
java.util.Map
serializeToMap()
protected void
setAdditionalProperty(java.lang.String name, java.lang.Object value)
protected void
setRootHash(byte[] h)
-
-
-
Field Detail
-
FLAG_BEP47_PAD
private static final byte FLAG_BEP47_PAD
- See Also:
- Constant Field Values
-
FLAG_OTHER_PAD
private static final byte FLAG_OTHER_PAD
- See Also:
- Constant Field Values
-
FLAG_OTHER_PAD_CHECKED
private static final byte FLAG_OTHER_PAD_CHECKED
- See Also:
- Constant Field Values
-
torrent
private final TOTorrentImpl torrent
-
index
private final int index
-
file_length
private final long file_length
-
path_components
private final byte[][] path_components
-
path_components_utf8
private final byte[][] path_components_utf8
-
first_piece_number
private final int first_piece_number
-
last_piece_number
private final int last_piece_number
-
additional_properties_maybe_null
private java.util.Map additional_properties_maybe_null
-
is_utf8
private final boolean is_utf8
-
flags
private byte flags
-
hash_tree
private final TOTorrentFileHashTreeImpl hash_tree
-
root_hash
private byte[] root_hash
-
-
Constructor Detail
-
TOTorrentFileImpl
protected TOTorrentFileImpl(TOTorrentImpl _torrent, int _index, long _torrent_offset, long _len, java.lang.String _path) throws TOTorrentException
- Throws:
TOTorrentException
-
TOTorrentFileImpl
protected TOTorrentFileImpl(TOTorrentImpl _torrent, int _index, long _torrent_offset, long _len, byte[][] _path_components) throws TOTorrentException
- Throws:
TOTorrentException
-
TOTorrentFileImpl
protected TOTorrentFileImpl(TOTorrentImpl _torrent, int _index, long _torrent_offset, long _len, byte[][] _path_components, byte[][] _path_components_utf8) throws TOTorrentException
- Throws:
TOTorrentException
-
TOTorrentFileImpl
protected TOTorrentFileImpl(TOTorrentImpl _torrent, int _index, long _torrent_offset, long _len, byte[][] _path_components, byte[][] _path_components_utf8, byte[] _v2_root_hash) throws TOTorrentException
- Throws:
TOTorrentException
-
-
Method Detail
-
checkComponents
protected void checkComponents() throws TOTorrentException
- Throws:
TOTorrentException
-
getTorrent
public TOTorrentImpl getTorrent()
- Specified by:
getTorrent
in interfaceTOTorrentFile
-
getIndex
public int getIndex()
- Specified by:
getIndex
in interfaceTOTorrentFile
-
getLength
public long getLength()
- Specified by:
getLength
in interfaceTOTorrentFile
-
getPathComponentsBasic
public byte[][] getPathComponentsBasic()
-
getPathComponents
public byte[][] getPathComponents()
- Specified by:
getPathComponents
in interfaceTOTorrentFile
-
getPathComponentsUTF8
public byte[][] getPathComponentsUTF8()
-
isUTF8
protected boolean isUTF8()
-
setAdditionalProperty
protected void setAdditionalProperty(java.lang.String name, java.lang.Object value)
-
getHashTree
public TOTorrentFileHashTreeImpl getHashTree()
Description copied from interface:TOTorrentFile
V2 torrents only - also null for zero length files- Specified by:
getHashTree
in interfaceTOTorrentFile
- Returns:
-
getRootHash
public byte[] getRootHash()
- Specified by:
getRootHash
in interfaceTOTorrentFile
-
setRootHash
protected void setRootHash(byte[] h)
-
getAdditionalProperties
public java.util.Map getAdditionalProperties()
- Specified by:
getAdditionalProperties
in interfaceTOTorrentFile
-
getFirstPieceNumber
public int getFirstPieceNumber()
- Specified by:
getFirstPieceNumber
in interfaceTOTorrentFile
-
getLastPieceNumber
public int getLastPieceNumber()
- Specified by:
getLastPieceNumber
in interfaceTOTorrentFile
-
getNumberOfPieces
public int getNumberOfPieces()
- Specified by:
getNumberOfPieces
in interfaceTOTorrentFile
-
isPadFile
public boolean isPadFile()
Description copied from interface:TOTorrentFile
is BEP_47 pad file- Specified by:
isPadFile
in interfaceTOTorrentFile
- Returns:
-
getRelativePath
public java.lang.String getRelativePath()
Description copied from interface:TOTorrentFile
Build a relative path based on path components, usingFile.separator
- Specified by:
getRelativePath
in interfaceTOTorrentFile
-
serializeToMap
public java.util.Map serializeToMap()
- Since:
- 4.1.0.5
-
-