wjhk.jupload2.upload
Class UploadFilePacket

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<UploadFileData>
              extended by wjhk.jupload2.upload.UploadFilePacket
All Implemented Interfaces:
Serializable, Cloneable, Iterable<UploadFileData>, Collection<UploadFileData>, List<UploadFileData>, RandomAccess
Direct Known Subclasses:
UploadFilePacketPoisonned

public class UploadFilePacket
extends ArrayList<UploadFileData>

This file contains a packet of files, which will be sent in one request to the server.

Author:
etienne_sf
See Also:
Serialized Form

Field Summary
(package private)  long maxNbBytes
          The maximum number of bytes in one packet to the server
(package private)  long maxNbFiles
          The maximum number of files in one packet to the server
(package private)  long nbBytes
          The sum of the size of all files in the packet.
(package private)  UploadPolicy uploadPolicy
          The uploadPolicy, useful to get the max number of files and max packet size ... and perhaps other parameters in the future.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
UploadFilePacket(UploadPolicy uploadPolicy)
          The standard constructor.
 
Method Summary
 boolean add(UploadFileData uploadFileData)
           
 boolean canAdd(UploadFileData uploadFileData)
          Checks if this packet can accept this file, according to the current UploadPolicy.
 boolean isFull()
          Indicates whether it is possible to add a file or not, to this packet, according to the current upload policy.
 boolean isPoisonned()
           
 UploadFileData remove(int index)
          Prohibited !
 boolean remove(Object o)
          Prohibited !
protected  void removeRange(int fromIndex, int toIndex)
          Prohibited !
 
Methods inherited from class java.util.ArrayList
add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

uploadPolicy

UploadPolicy uploadPolicy
The uploadPolicy, useful to get the max number of files and max packet size ... and perhaps other parameters in the future.


nbBytes

long nbBytes
The sum of the size of all files in the packet.


maxNbBytes

long maxNbBytes
The maximum number of bytes in one packet to the server


maxNbFiles

long maxNbFiles
The maximum number of files in one packet to the server

Constructor Detail

UploadFilePacket

UploadFilePacket(UploadPolicy uploadPolicy)
The standard constructor.

Parameters:
uploadPolicy -
Method Detail

canAdd

public boolean canAdd(UploadFileData uploadFileData)
Checks if this packet can accept this file, according to the current UploadPolicy.

Parameters:
uploadFileData -
Returns:
True if the file can be added, false otherwise.

isFull

public boolean isFull()
Indicates whether it is possible to add a file or not, to this packet, according to the current upload policy.

Returns:
true if the packet is full, that is: no file can be added to this packet.

add

public boolean add(UploadFileData uploadFileData)
Specified by:
add in interface Collection<UploadFileData>
Specified by:
add in interface List<UploadFileData>
Overrides:
add in class ArrayList<UploadFileData>
Parameters:
uploadFileData - The file to add to the packet
Returns:
true if the collection changed, that is: if the file was actually added. false if the Collection didn't change, that is: the packet is full, or th file is already there.

isPoisonned

public boolean isPoisonned()
Returns:
the poisonned status. Returns always false, as this instance is a true one. false indicates the 'End Of Queue' marker in the preparedFileQueue, which is not the case here
See Also:
UploadFileDataPoisonned

remove

public UploadFileData remove(int index)
Prohibited !

Specified by:
remove in interface List<UploadFileData>
Overrides:
remove in class ArrayList<UploadFileData>
See Also:
ArrayList.remove(int)

remove

public boolean remove(Object o)
Prohibited !

Specified by:
remove in interface Collection<UploadFileData>
Specified by:
remove in interface List<UploadFileData>
Overrides:
remove in class ArrayList<UploadFileData>
See Also:
ArrayList.remove(Object)

removeRange

protected void removeRange(int fromIndex,
                           int toIndex)
Prohibited !

Overrides:
removeRange in class ArrayList<UploadFileData>
See Also:
ArrayList.removeRange(int, int)