1 11 package org.eclipse.core.internal.resources; 12 13 import java.io.DataInputStream ; 14 import java.io.IOException ; 15 import org.eclipse.core.internal.utils.Messages; 16 import org.eclipse.core.runtime.CoreException; 17 import org.eclipse.osgi.util.NLS; 18 19 23 public class MarkerReader { 24 protected Workspace workspace; 25 26 public MarkerReader(Workspace workspace) { 27 super(); 28 this.workspace = workspace; 29 } 30 31 34 protected MarkerReader getReader(int formatVersion) throws IOException { 35 switch (formatVersion) { 36 case 1 : 37 return new MarkerReader_1(workspace); 38 case 2 : 39 return new MarkerReader_2(workspace); 40 case 3 : 41 return new MarkerReader_3(workspace); 42 default : 43 throw new IOException (NLS.bind(Messages.resources_format, new Integer (formatVersion))); 44 } 45 } 46 47 public void read(DataInputStream input, boolean generateDeltas) throws IOException , CoreException { 48 int formatVersion = readVersionNumber(input); 49 MarkerReader reader = getReader(formatVersion); 50 reader.read(input, generateDeltas); 51 } 52 53 protected static int readVersionNumber(DataInputStream input) throws IOException { 54 return input.readInt(); 55 } 56 } 57 | Popular Tags |