/* * Copyright (c) 2002-2004 Widespace, OU and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * Igor Malinin - initial contribution * * $Id: AbstractDocumentProvider.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $ */ package net.sourceforge.phpeclipse.xml.ui.internal.text; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import org.eclipse.jface.text.rules.IWhitespaceDetector; import net.sourceforge.phpeclipse.ui.editor.I18NDocumentProvider; /** * * * @author Igor Malinin */ public abstract class AbstractDocumentProvider extends I18NDocumentProvider { protected IWhitespaceDetector detector = new WhitespaceDetector(); /* * @see org.eclipse.ui.editors.text.IStorageDocumentProvider#getDefaultEncoding() */ public String getDefaultEncoding() { return "UTF-8"; } public String getDeclaredEncoding( InputStream in ) throws IOException { if ( !in.markSupported() ) { in = new BufferedInputStream( in, 512 ); } in.mark( 512 ); String encoding = super.getDeclaredEncoding( in ); if ( encoding != null ) { return encoding; } in.reset(); // check Prolog-Start