Sync with latest bnd code for testing purposes
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1354104 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/Document.java b/bundleplugin/src/main/java/aQute/lib/properties/Document.java
new file mode 100644
index 0000000..4df75a6
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/Document.java
@@ -0,0 +1,59 @@
+package aQute.lib.properties;
+
+public class Document implements IDocument {
+
+ public final static String[] DELIMITERS = {
+ "\r", "\n", "\r\n"
+ };
+
+ private LineTracker lineTracker = new LineTracker();
+ private ITextStore textStore = new CopyOnWriteTextStore(new GapTextStore());
+
+ public Document(String text) {
+ setText(text);
+ }
+
+ public int getNumberOfLines() {
+ return lineTracker.getNumberOfLines();
+ }
+
+ public IRegion getLineInformation(int line) throws BadLocationException {
+ return lineTracker.getLineInformation(line);
+ }
+
+ public String get(int offset, int length) throws BadLocationException {
+ return textStore.get(offset, length);
+ }
+
+ public String getLineDelimiter(int line) throws BadLocationException {
+ return lineTracker.getLineDelimiter(line);
+ }
+
+ public int getLength() {
+ return textStore.getLength();
+ }
+
+ public void replace(int offset, int length, String text) throws BadLocationException {
+ textStore.replace(offset, length, text);
+ lineTracker.set(get());
+ }
+
+ public char getChar(int pos) {
+ return textStore.get(pos);
+ }
+
+ public void setText(String text) {
+ textStore.set(text);
+ lineTracker.set(text);
+ }
+
+ public String get() {
+ return textStore.get(0, textStore.getLength());
+ }
+
+ protected static class DelimiterInfo {
+ public int delimiterIndex;
+ public int delimiterLength;
+ public String delimiter;
+ }
+}