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.osgi.util.NLS; 17 18 public class SyncInfoSnapReader { 19 protected Workspace workspace; 20 protected Synchronizer synchronizer; 21 22 public SyncInfoSnapReader(Workspace workspace, Synchronizer synchronizer) { 23 super(); 24 this.workspace = workspace; 25 this.synchronizer = synchronizer; 26 } 27 28 31 protected SyncInfoSnapReader getReader(int formatVersion) throws IOException { 32 switch (formatVersion) { 33 case 3 : 34 return new SyncInfoSnapReader_3(workspace, synchronizer); 35 default : 36 throw new IOException (NLS.bind(Messages.resources_format, new Integer (formatVersion))); 37 } 38 } 39 40 public void readSyncInfo(DataInputStream input) throws IOException { 41 int formatVersion = readVersionNumber(input); 44 SyncInfoSnapReader reader = getReader(formatVersion); 45 reader.readSyncInfo(input); 46 } 47 48 protected static int readVersionNumber(DataInputStream input) throws IOException { 49 return input.readInt(); 50 } 51 } 52 | Popular Tags |