Package org.apache.commons.net.io
Class CopyStreamEvent
- java.lang.Object
-
- java.util.EventObject
-
- org.apache.commons.net.io.CopyStreamEvent
-
- All Implemented Interfaces:
java.io.Serializable
public class CopyStreamEvent extends java.util.EventObjectA CopyStreamEvent is triggered after every write performed by a stream copying operation. The event stores the number of bytes transferred by the write triggering the event as well as the total number of bytes transferred so far by the copy operation.- See Also:
CopyStreamListener,CopyStreamAdapter,Util, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private intbytesTransferredThe number of bytes transferred during the write that triggered the CopyStreamEvent.private static longserialVersionUIDprivate longstreamSizeThe number of bytes in the stream being copied.private longtotalBytesTransferredThe total number of bytes transferred so far during a copy operation.static longUNKNOWN_STREAM_SIZEConstant used to indicate the stream size is unknown.
-
Constructor Summary
Constructors Constructor Description CopyStreamEvent(java.lang.Object source, long totalBytesTransferred, int bytesTransferred, long streamSize)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBytesTransferred()Gets the number of bytes transferred by the write that triggered the event.longgetStreamSize()Gets the size of the stream being copied.longgetTotalBytesTransferred()Gets the total number of bytes transferred so far by the copy operation.java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
UNKNOWN_STREAM_SIZE
public static final long UNKNOWN_STREAM_SIZE
Constant used to indicate the stream size is unknown.- See Also:
- Constant Field Values
-
bytesTransferred
private final int bytesTransferred
The number of bytes transferred during the write that triggered the CopyStreamEvent.
-
totalBytesTransferred
private final long totalBytesTransferred
The total number of bytes transferred so far during a copy operation.
-
streamSize
private final long streamSize
The number of bytes in the stream being copied. This may be set toUNKNOWN_STREAM_SIZEif the size is unknown.
-
-
Constructor Detail
-
CopyStreamEvent
public CopyStreamEvent(java.lang.Object source, long totalBytesTransferred, int bytesTransferred, long streamSize)Constructs a new instance.- Parameters:
source- The source of the event.totalBytesTransferred- The total number of bytes transferred so far during a copy operation.bytesTransferred- The number of bytes transferred during the write that triggered the CopyStreamEvent.streamSize- The number of bytes in the stream being copied. This may be set toUNKNOWN_STREAM_SIZEif the size is unknown.
-
-
Method Detail
-
getBytesTransferred
public int getBytesTransferred()
Gets the number of bytes transferred by the write that triggered the event.- Returns:
- The number of bytes transferred by the write that triggered the vent.
-
getStreamSize
public long getStreamSize()
Gets the size of the stream being copied. This may be set toUNKNOWN_STREAM_SIZEif the size is unknown.- Returns:
- The size of the stream being copied.
-
getTotalBytesTransferred
public long getTotalBytesTransferred()
Gets the total number of bytes transferred so far by the copy operation.- Returns:
- The total number of bytes transferred so far by the copy operation.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.EventObject- Since:
- 3.0
-
-