forked from sporst/JHexView
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIDataProvider.java
More file actions
62 lines (54 loc) · 1.91 KB
/
IDataProvider.java
File metadata and controls
62 lines (54 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Modified Oct. 2014 by argent77
* - added JavaDoc comments
* - removed prototype: byte[] getData()
*/
package tv.porst.jhexview;
public interface IDataProvider
{
/**
* Adds a listener to the DataProvider that will receive events whenever data has been changed.
* @param listener The listener that will receive the DataChangedEvents.
*/
void addListener(IDataChangedListener listener);
/**
* Returns a data segment of a given length as byte array.
* @param offset The start offset of the data.
* @param length The length of the data in bytes.
* @return Requested data as byte array.
*/
byte[] getData(long offset, int length);
/**
* Returns the data length in number of bytes.
* @return The data length in number of bytes.
*/
int getDataLength();
/**
* Returns whether the requested data segment is available.
* @param offset The start offset of the requested data.
* @param length The length of the requested data in bytes.
* @return True if the requested data segment is available, false otherwise.
*/
boolean hasData(long start, int length);
/** Returns whether the data stream provided by this instance is writeable. */
boolean isEditable();
/**
* Returns whether the data segment requested by the last call of {@link #hasData(long, int)}
* is available.
* @return True if data segment is not available. False if the data segment can be fetched by
* {@link #getData(long, int)}.
*/
boolean keepTrying();
/**
* Removes a listener from the DataProvider.
* @param listener The listener to remove.
*/
void removeListener(IDataChangedListener listener);
/**
* Writes the specified data at the given offset. Note: Only works if {@link #isEditable()}
* returns <code>true</code>.
* @param offset The start offset for the data to be written.
* @param data The data to write.
*/
void setData(long offset, byte[] data);
}