Package weasel.interpreter

Examples of weasel.interpreter.WeaselRuntimeException


 
  public static WeaselClassFile load(byte[] byteArray){
    try {
      return load(new DataInputStream(new ByteArrayInputStream(byteArray)));
    } catch (IOException e) {
      throw new WeaselRuntimeException("Error while read class file");
    }
  }
View Full Code Here


  }
 
  public static WeaselClassFile load(DataInputStream dataInputStream) throws IOException{
    int magicNumber = dataInputStream.readInt();
    if(magicNumber!=MAGICNUMBER)
      throw new WeaselRuntimeException("Magic number isn't the same");
    int version = dataInputStream.readInt();
    WeaselVersionClassFileLoader wvcfl = null;
    for(WeaselVersionGetter wvg:versions){
      wvcfl = wvg.getVersionClassFileLoader(version);
      if(wvcfl!=null)
        break;
    }
    if(wvcfl==null)
      throw new WeaselRuntimeException("Unkonw version %s", version);
    return wvcfl.load(dataInputStream);
  }
View Full Code Here

  public static byte[] save(WeaselClassFile weaselClassFile, int version){
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
      save(new DataOutputStream(baos), weaselClassFile, version);
    } catch (IOException e) {
      throw new WeaselRuntimeException("Error while write class file");
    }
    return baos.toByteArray();
  }
View Full Code Here

      wvcfs = wvg.getVersionClassFileSaver(version);
      if(wvcfs!=null)
        break;
    }
    if(wvcfs==null)
      throw new WeaselRuntimeException("Unkonw version %s", version);
    wvcfs.save(dataOutputStream, weaselClassFile);
  }
View Full Code Here

TOP

Related Classes of weasel.interpreter.WeaselRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.