Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/DocumentInputStream.java')
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/DocumentInputStream.java108
1 files changed, 0 insertions, 108 deletions
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/DocumentInputStream.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/DocumentInputStream.java
deleted file mode 100644
index 6c259a2a6c..0000000000
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/util/DocumentInputStream.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.core.internal.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-
-public class DocumentInputStream extends InputStream {
- private IDocument fDocument;
- private int fMark = -1;
- private int fPosition = 0;
-
- public DocumentInputStream(IDocument source) {
- super();
- fDocument = source;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.InputStream#available()
- */
- public int available() throws IOException {
- return fDocument.getLength() - fPosition;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.InputStream#close()
- */
- public void close() throws IOException {
- this.fDocument = null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.InputStream#mark(int)
- */
- public synchronized void mark(int readlimit) {
- fMark = fPosition;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.InputStream#markSupported()
- */
- public boolean markSupported() {
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.InputStream#read()
- */
- public int read() throws IOException {
- try {
- if (fPosition < fDocument.getLength())
- return fDocument.getChar(fPosition++);
- else
- return -1;
- } catch (BadLocationException e) {
- throw new IOException(e.getMessage());
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.InputStream#reset()
- */
- public synchronized void reset() throws IOException {
- fPosition = fMark;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.io.InputStream#skip(long)
- */
- public long skip(long n) throws IOException {
- long skipped = n;
- if (n < fDocument.getLength() - fPosition) {
- skipped = n;
- fPosition += skipped;
- } else {
- skipped = fDocument.getLength() - fPosition;
- fPosition = fDocument.getLength();
- }
- return skipped;
- }
-}

Back to the top