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 public class MarkerSnapshotReader { 20 protected Workspace workspace; 21 22 public MarkerSnapshotReader(Workspace workspace) { 23 super(); 24 this.workspace = workspace; 25 } 26 27 30 protected MarkerSnapshotReader getReader(int formatVersion) throws IOException { 31 switch (formatVersion) { 32 case 1 : 33 return new MarkerSnapshotReader_1(workspace); 34 case 2 : 35 return new MarkerSnapshotReader_2(workspace); 36 default : 37 throw new IOException (NLS.bind(Messages.resources_format, new Integer (formatVersion))); 38 } 39 } 40 41 public void read(DataInputStream input) throws IOException , CoreException { 42 int formatVersion = readVersionNumber(input); 43 MarkerSnapshotReader reader = getReader(formatVersion); 44 reader.read(input); 45 } 46 47 protected static int readVersionNumber(DataInputStream input) throws IOException { 48 return input.readInt(); 49 } 50 } 51 | Popular Tags |