Java Examples for java.io.IOException

The following java examples will help you to understand the usage of java.io.IOException. These source code samples are taken from different open source projects.

Example 1
Project: IKVM.NET-cvs-clone-master  File: InputStreamWrapper.java View source code
public int read() throws java.io.IOException {
    try {
        if (false)
            throw new cli.System.IO.IOException();
        if (false)
            throw new cli.System.ObjectDisposedException(null);
        int i = stream.ReadByte();
        if (i == -1) {
            atEOF = true;
        }
        return i;
    } catch (cli.System.IO.IOException x) {
        java.io.IOException ex = new java.io.IOException();
        ex.initCause(x);
        throw ex;
    } catch (cli.System.ObjectDisposedException x) {
        java.io.IOException ex = new java.io.IOException();
        ex.initCause(x);
        throw ex;
    }
}
Example 2
Project: eclipse.jdt.ui-master  File: Catch2.java View source code
public void foo(int a, IOException second) throws Exception {
    try {
        if (a < 10)
            throw new FileNotFoundException();
        else if (a < 20)
            throw new InterruptedIOException();
    } catch (FileNotFoundExceptionInterruptedIOException |  ex) {
        second.printStackTrace();
    }
}
Example 3
Project: ARTPart-master  File: IOExceptionTest.java View source code
/**
     * java.io.IOException#IOException(java.lang.String,
     *java.lang.Throwable)
     * @since 1.6
     */
public void test_ConstructorLString_LThrowable() {
    // Test for constructor java.io.IOException(java.lang.String, java.lang.Throwable)
    IOException ioException = new IOException("A dummy IOException", //$NON-NLS-1$//$NON-NLS-2$
    new Throwable("A dummy Throwable"));
    //$NON-NLS-1$
    assertEquals("A dummy IOException", ioException.getMessage());
    try {
        throw new IOException("A dummy error", //$NON-NLS-1$ //$NON-NLS-2$
        new Throwable("Some error message"));
    } catch (IOException e) {
        return;
    } catch (Exception e) {
        fail("Exception during IOException test" + e.toString());
    }
    //$NON-NLS-1$
    fail("Failed to generate exception");
}
Example 4
Project: ikvm-openjdk-master  File: RMIConnectionImpl_Stub.java View source code
// methods from remote interfaces
// implementation of addNotificationListener(ObjectName, ObjectName, MarshalledObject, MarshalledObject, Subject)
public void addNotificationListener(javax.management.ObjectName $param_ObjectName_1, javax.management.ObjectName $param_ObjectName_2, java.rmi.MarshalledObject $param_MarshalledObject_3, java.rmi.MarshalledObject $param_MarshalledObject_4, javax.security.auth.Subject $param_Subject_5) throws java.io.IOException, javax.management.InstanceNotFoundException {
    try {
        ref.invoke(this, $method_addNotificationListener_0, new java.lang.Object[] { $param_ObjectName_1, $param_ObjectName_2, $param_MarshalledObject_3, $param_MarshalledObject_4, $param_Subject_5 }, -8578317696269497109L);
    } catch (java.lang.RuntimeException e) {
        throw e;
    } catch (java.io.IOException e) {
        throw e;
    } catch (javax.management.InstanceNotFoundException e) {
        throw e;
    } catch (java.lang.Exception e) {
        throw new java.rmi.UnexpectedException("undeclared checked exception", e);
    }
}
Example 5
Project: openjdk8-jdk-master  File: ForceLogSnapshot_Skel.java View source code
public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception {
    if (opnum < 0) {
        if (hash == 8484760490859430950L) {
            opnum = 0;
        } else if (hash == -1519179153769139224L) {
            opnum = 1;
        } else {
            throw new java.rmi.UnmarshalException("invalid method hash");
        }
    } else {
        if (hash != interfaceHash)
            throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
    }
    ForceLogSnapshot server = (ForceLogSnapshot) obj;
    switch(opnum) {
        case // crash()
        0:
            {
                call.releaseInputStream();
                server.crash();
                try {
                    call.getResultStream(true);
                } catch (java.io.IOException e) {
                    throw new java.rmi.MarshalException("error marshalling return", e);
                }
                break;
            }
        case // ping(int, String)
        1:
            {
                int $param_int_1;
                java.lang.String $param_String_2;
                try {
                    java.io.ObjectInput in = call.getInputStream();
                    $param_int_1 = in.readInt();
                    $param_String_2 = (java.lang.String) in.readObject();
                } catch (java.io.IOException e) {
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } catch (java.lang.ClassNotFoundException e) {
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } finally {
                    call.releaseInputStream();
                }
                server.ping($param_int_1, $param_String_2);
                try {
                    call.getResultStream(true);
                } catch (java.io.IOException e) {
                    throw new java.rmi.MarshalException("error marshalling return", e);
                }
                break;
            }
        default:
            throw new java.rmi.UnmarshalException("invalid method number");
    }
}
Example 6
Project: schach-master  File: NXTSamba.java View source code
/**
     * Open the specified USB device and check that it is in SAM-BA mode. We
     * switch the device into "quiet" mode and also download the FlashWrite
     * program.
     * @param nxt Device to open.
     * @return true if the device is now open, false otherwise.
     * @throws java.io.IOException
     */
public boolean open(NXTInfo nxt) throws IOException {
    if (nxtComm.open(nxt, NXTComm.RAW)) {
        try {
            // We first set the device to interactive/text mode verbose mode
            // (which is the default) and wait for the prompt. This is safe no matter
            // whether the device originally is in interactive or quiet mode.
            // Then we switch back to quiet mode and ask for the version string.
            // This matches the behavior of the original SAM-BA software
            // Switch into quiet mode, NXT may answer with line-feed if in verbose mode
            sendInitCommand(CMD_TEXT);
            while (!endsWithPrompt(read())) {
            /* wait for prompt */
            }
            // Switch into quiet mode, NXT may answer with line-feed if in verbose mode
            sendInitCommand(CMD_NON_TEXT);
            //discard response
            readLine();
            // Ask for version number, terminated by line-feed
            sendInitCommand(CMD_VERSION);
            // Example version string: "v1.4 Nov 10 2004 14:49:33"
            version = readLine().trim();
            // strip everything after the first whitespace 
            version = version.replaceAll("\\s.*", "");
            // Check that we are all in sync
            System.out.println("Connected to SAM-BA " + version);
            // Now upload the flash writer helper routine
            writeBytes(HELPER_CODEADR, getModifiedHelper());
            // And set the the clock into PLL/2 mode ready for writing
            writeWord(0xfffffc30, 0x7);
            return true;
        } catch (IOException e) {
        }
        // Unable to sync things make sure the device is closed.
        nxtComm.close();
    }
    return false;
}
Example 7
Project: jeboorker-master  File: TextUtils.java View source code
public static StringBuilder removePageNumbers(String text) {
    StringBuilder result = new StringBuilder();
    try (BufferedReader textReader = new BufferedReader(new StringReader(text))) {
        String line;
        for (int i = 1; (line = trim(textReader.readLine())) != null; ) {
            int num = NumberUtils.toInt(line, -1);
            if (num == i) {
                i++;
                continue;
            }
            result.append(line).append(StringUtil.NEW_LINE);
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    return result;
}
Example 8
Project: jeql-master  File: DbfFile.java View source code
/**
            * Fetches a part column of Integers from the database file.
            * @param int col - the column to fetch
            * @param int start - the row to start fetching from
            * @param int end - the row to stop fetching at.
            * @exception java.io.IOException - on read error
            * @exception DbfFileException - column is not an Integer.
            */
public Integer[] getIntegerCol(int col, int start, int end) throws java.io.IOException, DbfFileException {
    Integer[] column = new Integer[end - start];
    String record = new String();
    StringBuffer sb = new StringBuffer(numfields);
    int k = 0;
    int i = 0;
    if (col >= numfields) {
        throw new DbfFileException("DbFi>No Such Column in file: " + col);
    }
    if (fielddef[col].fieldtype != 'N') {
        throw new DbfFileException("DbFi>Column " + col + " is not Integer");
    }
    // move to start of data
    try {
        rFile.seek(data_offset + (rec_size * start));
        for (i = start; i < end; i++) {
            sb.setLength(0);
            for (k = 0; k < rec_size; k++) sb.append((char) rFile.readUnsignedByte());
            record = sb.toString();
            try {
                column[i - start] = new Integer(record.substring(fielddef[col].fieldstart, fielddef[col].fieldstart + fielddef[col].fieldlen));
            } catch (java.lang.NumberFormatException e) {
                column[i - start] = new Integer(0);
            }
        }
    } catch (java.io.EOFException e) {
        System.err.println("DbFi>" + e);
        System.err.println("DbFi>record " + i + " byte " + k + " file pos " + rFile.getFilePointer());
    } catch (java.io.IOException e) {
        System.err.println("DbFi>" + e);
        System.err.println("DbFi>record " + i + " byte " + k + " file pos " + rFile.getFilePointer());
    }
    return column;
}
Example 9
Project: gpu-garbage-collection-master  File: TestSerialization.java View source code
public static void main(String[] args) throws Exception {
    //Uncomment when need to generate serialized data from jdk again
    /*
    try {
      final ObjectOutputStream output = new ObjectOutputStream(new java.io.FileOutputStream("MySerializationData.dat"));
      output.writeObject(new SerializationData());
      output.close();
    } catch (java.io.IOException e) {
      e.printStackTrace(System.out);
    }
*/
    final byte[] data = loadData();
    try {
        final ObjectInputStream input = new ObjectInputStream(new ByteArrayInputStream(data));
        System.out.println("Attemping read");
        final SerializationData ts = (SerializationData) input.readObject();
        System.out.println("Existing serialization read");
        System.out.println(ts);
    } catch (java.io.IOException e) {
        e.printStackTrace(System.out);
    } catch (ClassNotFoundException e) {
        e.printStackTrace(System.out);
    }
    byte[] bytes = new byte[0];
    try {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        final ObjectOutputStream output = new ObjectOutputStream(baos);
        System.out.println("Attemping write");
        SerializationData sd = new SerializationData();
        sd.jitter();
        output.writeObject(sd);
        output.flush();
        output.close();
        bytes = baos.toByteArray();
        System.out.println("write success. Checking consistency of data written ...");
        System.out.println("actual.length (" + bytes.length + ") vs expected.length (" + data.length);
        for (int i = 0; i < data.length && i < bytes.length; i++) {
            if (data[i] != bytes[i]) {
                System.out.println("data differs at " + i);
                break;
            }
        }
    } catch (java.io.IOException e) {
        e.printStackTrace(System.out);
    }
    try {
        final ObjectInputStream input = new ObjectInputStream(new ByteArrayInputStream(bytes));
        System.out.println("Attemping read of output data");
        final SerializationData ts = (SerializationData) input.readObject();
        System.out.println("Existing serialization read");
        System.out.println(ts);
    } catch (java.io.IOException e) {
        e.printStackTrace(System.out);
    } catch (ClassNotFoundException e) {
        e.printStackTrace(System.out);
    }
}
Example 10
Project: android_packages_apps-master  File: NdefPushProtocol.java View source code
public byte[] toByteArray() {
    ByteArrayOutputStream buffer = new ByteArrayOutputStream(1024);
    DataOutputStream output = new DataOutputStream(buffer);
    try {
        output.writeByte(VERSION);
        output.writeInt(mNumMessages);
        for (int i = 0; i < mNumMessages; i++) {
            output.writeByte(mActions[i]);
            byte[] bytes = mMessages[i].toByteArray();
            output.writeInt(bytes.length);
            output.write(bytes);
        }
    } catch (java.io.IOException e) {
        return null;
    }
    return buffer.toByteArray();
}
Example 11
Project: sonar-java-master  File: InterruptedExceptionCheck.java View source code
public void run() throws InterruptedException {
    try {
        while (true) {
        // do stuff
        }
    } catch (InterruptedException e) {
        LOGGER.log(Level.WARN, "Interrupted!", e);
        throw e;
    } catch (// Noncompliant {{Either re-interrupt this method or rethrow the "InterruptedException".}}
    InterruptedException // Noncompliant {{Either re-interrupt this method or rethrow the "InterruptedException".}}
    e) {
        LOGGER.log(Level.WARN, "Interrupted!", e);
        throw new java.io.IOException();
    } catch (// Noncompliant {{Either re-interrupt this method or rethrow the "InterruptedException".}}
    InterruptedException // Noncompliant {{Either re-interrupt this method or rethrow the "InterruptedException".}}
    e) {
        LOGGER.log(Level.WARN, "Interrupted!", e);
        Exception e1 = new Exception();
        throw e1;
    } catch (// Noncompliant {{Either re-interrupt this method or rethrow the "InterruptedException".}}
    InterruptedException // Noncompliant {{Either re-interrupt this method or rethrow the "InterruptedException".}}
    e) {
        LOGGER.log(Level.WARN, "Interrupted!", e);
        throw new IllegalStateException("foo", e);
    }
}
Example 12
Project: openjdk-master  File: ImplicitFinal.java View source code
public static void main(String... args) {
    try (ImplicitFinal r = new ImplicitFinal()) {
        //disallowed
        r = null;
    } catch (// Not reachable
    IOException // Not reachable
    ioe) {
        throw new AssertionError("Shouldn't reach here", ioe);
    }
    try (@SuppressWarnings("unchecked") ImplicitFinal r1 = new ImplicitFinal()) {
        //disallowed
        r1 = null;
    } catch (// Not reachable
    IOException // Not reachable
    ioe) {
        throw new AssertionError("Shouldn't reach here", ioe);
    }
    try (final ImplicitFinal r2 = new ImplicitFinal()) {
        //disallowed
        r2 = null;
    } catch (// Not reachable
    IOException // Not reachable
    ioe) {
        throw new AssertionError("Shouldn't reach here", ioe);
    }
    try (@SuppressWarnings("unchecked") final ImplicitFinal r3 = new ImplicitFinal()) {
        //disallowed
        r3 = null;
    } catch (// Not reachable
    IOException // Not reachable
    ioe) {
        throw new AssertionError("Shouldn't reach here", ioe);
    }
}
Example 13
Project: oobd-master  File: JcaCRLStore.java View source code
private static Collection convertCRLs(Collection collection) throws CRLException {
    List list = new ArrayList(collection.size());
    for (Iterator it = collection.iterator(); it.hasNext(); ) {
        Object crl = it.next();
        if (crl instanceof X509CRL) {
            try {
                list.add(new X509CRLHolder(((X509CRL) crl).getEncoded()));
            } catch (IOException e) {
                throw new CRLException("cannot read encoding: " + e.getMessage());
            }
        } else {
            list.add((X509CRLHolder) crl);
        }
    }
    return list;
}
Example 14
Project: bixie-master  File: MainClassTest.java View source code
@Test
public void test() {
    final File source_file = new File(testRoot + "ic_java/true_positives/TruePositives02.java");
    File classFileDir = null;
    try {
        classFileDir = compileJavaFile(source_file);
        Bixie.main(new String[] { "-j", classFileDir.getAbsolutePath(), "-logProver", "test" });
    } catch (IOException e) {
        e.printStackTrace();
        fail("Not yet implemented");
    } finally {
        if (classFileDir != null) {
            try {
                delete(classFileDir);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
Example 15
Project: android-platform-tools-base-master  File: LibApp.java View source code
private static String getContent() {
    InputStream input = LibApp.class.getResourceAsStream("Libapp.txt");
    if (input == null) {
        return "FAILED TO FIND Libapp.txt";
    }
    BufferedReader reader = null;
    try {
        reader = new BufferedReader(new InputStreamReader(input, "UTF-8"));
        return reader.readLine();
    } catch (IOException e) {
    } finally {
        if (reader != null) {
            try {
                reader.close();
            } catch (IOException e) {
            }
        }
    }
    return "FAILED TO READ CONTENT";
}
Example 16
Project: FTL-Hyperion-master  File: InputStreamSender.java View source code
protected final Object next() {
    try {
        int total = 0;
        while (total < chunk.length) {
            int count = input.read(chunk, total, chunk.length - total);
            if (count < 0) {
                if (total == 0)
                    return null;
                byte[] partial = new byte[total];
                System.arraycopy(chunk, 0, partial, 0, total);
                return partial;
            }
            total += count;
        }
    } catch (IOException ex) {
        throw new KryoNetException(ex);
    }
    return next(chunk);
}
Example 17
Project: geotools-old-master  File: TypeNameChooser.java View source code
public static String showTypeNameChooser(DataStore dataStore) {
    if (dataStore == null) {
        // could not connect
        return null;
    }
    String typeNames[];
    try {
        typeNames = dataStore.getTypeNames();
    } catch (IOException e) {
        return null;
    }
    if (typeNames.length == 0) {
        // could not connect
        return null;
    }
    if (typeNames.length == 1) {
        // no need to choose only one option
        return typeNames[0];
    } else {
        String typeName = (String) JOptionPane.showInputDialog(null, "Please select a type name.", "Type Name", JOptionPane.QUESTION_MESSAGE, null, typeNames, typeNames[0]);
        return typeName;
    }
}
Example 18
Project: hdt-java-master  File: HDTGenerateIndex.java View source code
public static void main(String[] args) {
    try {
        if (args.length != 1) {
            System.out.println("HDTGenerateIndex <hdtFile>");
            System.exit(-1);
        }
        String hdtFileName = args[0];
        HDT hdt = HDTManager.mapHDT(hdtFileName, null);
        if (hdtFileName.endsWith(".gz")) {
            hdtFileName = hdtFileName.substring(0, hdtFileName.length() - 3);
        }
        System.out.println("Generating " + hdtFileName + ".index");
        HDTManager.indexedHDT(hdt, new ProgressListener() {

            @Override
            public void notifyProgress(float level, String message) {
            //					System.out.println(message + "\t"+ Float.toString(level));
            }
        }).close();
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    ;
}
Example 19
Project: checkstyle-master  File: InputFinalInTryWithResource.java View source code
public static void test() {
    try {
    } catch (RuntimeException e) {
    }
    try (@NotNull BufferedReader br = new BufferedReader(new InputStreamReader(null, "utf-8"))) {
    } catch (IOException e) {
    }
    try (final BufferedReader br = new BufferedReader(new InputStreamReader(null, "utf-8"))) {
    } catch (IOException e) {
    }
    try (final BufferedReader br = new BufferedReader(new InputStreamReader(null, "utf-8"));
        final BufferedReader br2 = new BufferedReader(new InputStreamReader(null, "utf-8"))) {
    } catch (IOException e) {
    }
}
Example 20
Project: metrics-master  File: InstrumentedResource.java View source code
@GET
@ExceptionMetered(cause = IOException.class)
@Path("/exception-metered")
public String exceptionMetered(@QueryParam("splode") @DefaultValue("false") boolean splode) throws IOException {
    if (splode) {
        throw new IOException("AUGH");
    }
    return "fuh";
}
Example 21
Project: tapestry-facebook-master  File: Channel.java View source code
Object onActivate() {
    return new StreamResponse() {

        public String getContentType() {
            return "text/html";
        }

        public InputStream getStream() throws IOException {
            return new ByteArrayInputStream(response.getBytes());
        }

        public void prepareResponse(Response response) {
            Date date = new Date();
            response.setDateHeader("Expires", date.getTime() + (maxAge * 1000));
            response.setHeader("Cache-Control", "max-age=" + maxAge);
            response.setHeader("Pragma", "public");
        }
    };
}
Example 22
Project: my-ministry-assistant-master  File: DailyBackupService.java View source code
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    File intDB = getApplicationContext().getDatabasePath(MinistryDatabase.DATABASE_NAME);
    File extDB = FileUtils.getExternalDBFile(getApplicationContext(), "auto-daily.db");
    try {
        if (extDB != null) {
            if (!extDB.exists())
                extDB.createNewFile();
            FileUtils.copyFile(intDB, extDB);
        }
    } catch (IOException e) {
        Toast.makeText(getApplicationContext(), "Error during daily backup", Toast.LENGTH_LONG).show();
    }
    return Service.START_NOT_STICKY;
}
Example 23
Project: snap-desktop-master  File: DesktopHelper.java View source code
public static void browse(String uriString) {
    final Desktop desktop = Desktop.getDesktop();
    URI uri;
    try {
        uri = new URI(uriString);
    } catch (URISyntaxException e) {
        Dialogs.showError(String.format("Internal error: Invalid URI:\n%s", uriString));
        return;
    }
    try {
        desktop.browse(uri);
    } catch (IOException e) {
        Dialogs.showError(String.format("<html>Failed to open URL in browser:<br><a href=\"%s\">%s</a>", uriString, uriString));
    } catch (UnsupportedOperationException e) {
        Dialogs.showError("Sorry, it seems that there is no browser available.");
    }
}
Example 24
Project: download-manager-master  File: CheckedWriter.java View source code
@Override
public DownloadTask.State write(DownloadTask.State state, byte[] buffer, int count) throws StopRequestException {
    spaceVerifier.verifySpacePreemptively(count);
    boolean forceVerified = false;
    while (true) {
        try {
            state.gotData = true;
            outputStream.write(buffer, 0, count);
            state.currentBytes += count;
            return state;
        } catch (IOException ex) {
            if (!forceVerified) {
                spaceVerifier.verifySpace(count);
                forceVerified = true;
            } else {
                throw new StopRequestException(DownloadStatus.FILE_ERROR, "Failed to write data: " + ex);
            }
        }
    }
}
Example 25
Project: flare-spork-master  File: TableSchemaParserTokenManager.java View source code
private int jjMoveStringLiteralDfa1_0(long active0) {
    try {
        curChar = input_stream.readChar();
    } catch (java.io.IOException e) {
        jjStopStringLiteralDfa_0(0, active0);
        return 1;
    }
    switch(curChar) {
        case 65:
        case 97:
            return jjMoveStringLiteralDfa2_0(active0, 0x21000L);
        case 69:
        case 101:
            return jjMoveStringLiteralDfa2_0(active0, 0x10000L);
        case 76:
        case 108:
            return jjMoveStringLiteralDfa2_0(active0, 0x400L);
        case 78:
        case 110:
            return jjMoveStringLiteralDfa2_0(active0, 0x80L);
        case 79:
        case 111:
            return jjMoveStringLiteralDfa2_0(active0, 0x8b00L);
        case 84:
        case 116:
            return jjMoveStringLiteralDfa2_0(active0, 0x2000L);
        case 89:
        case 121:
            return jjMoveStringLiteralDfa2_0(active0, 0x4000L);
        default:
            break;
    }
    return jjStartNfa_0(0, active0);
}
Example 26
Project: RedReader-master  File: JsonBufferedArray.java View source code
public boolean hasNext() {
    synchronized (JsonBufferedArray.this) {
        while (getStatus() == STATUS_LOADING && items <= currentId) {
            try {
                JsonBufferedArray.this.wait();
            } catch (final InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
        if (getStatus() == STATUS_FAILED) {
            try {
                throwFailReasonException();
            } catch (final IOException e) {
                throw new RuntimeException(e);
            }
        }
        return items > currentId;
    }
}
Example 27
Project: TextSecureSMP-master  File: Base64.java View source code
// end encodeObject
/**
     * Serializes an object and returns the Base64-encoded
     * version of that serialized object.
     *  
     * <p>As of v 2.3, if the object
     * cannot be serialized or there is another error,
     * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
     * In earlier versions, it just returned a null value, but
     * in retrospect that's a pretty poor way to handle it.</p>
     * 
     * The object is not GZip-compressed before being encoded.
     * <p>
     * Example options:<pre>
     *   GZIP: gzip-compresses object before encoding it.
     *   DO_BREAK_LINES: break lines at 76 characters
     * </pre>
     * <p>
     * Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
     * <p>
     * Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
     *
     * @param serializableObject The object to encode
     * @param options Specified options
     * @return The Base64-encoded object
     * @see Base64#GZIP
     * @see Base64#DO_BREAK_LINES
     * @throws java.io.IOException if there is an error
     * @since 2.0
     */
public static String encodeObject(java.io.Serializable serializableObject, int options) throws java.io.IOException {
    if (serializableObject == null) {
        throw new NullPointerException("Cannot serialize a null object.");
    }
    // end if: null
    // Streams
    java.io.ByteArrayOutputStream baos = null;
    java.io.OutputStream b64os = null;
    java.util.zip.GZIPOutputStream gzos = null;
    java.io.ObjectOutputStream oos = null;
    try {
        // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
        baos = new java.io.ByteArrayOutputStream();
        b64os = new Base64.OutputStream(baos, ENCODE | options);
        if ((options & GZIP) != 0) {
            // Gzip
            gzos = new java.util.zip.GZIPOutputStream(b64os);
            oos = new java.io.ObjectOutputStream(gzos);
        } else {
            // Not gzipped
            oos = new java.io.ObjectOutputStream(b64os);
        }
        oos.writeObject(serializableObject);
    }// end try
     catch (java.io.IOException e) {
        throw e;
    } finally // end catch
    {
        try {
            oos.close();
        } catch (Exception e) {
        }
        try {
            gzos.close();
        } catch (Exception e) {
        }
        try {
            b64os.close();
        } catch (Exception e) {
        }
        try {
            baos.close();
        } catch (Exception e) {
        }
    }
    // Return value according to relevant encoding.
    try {
        return new String(baos.toByteArray(), PREFERRED_ENCODING);
    }// end try
     catch (java.io.UnsupportedEncodingException uue) {
        return new String(baos.toByteArray());
    }
// end catch
}
Example 28
Project: Technomap-master  File: JavaCharStream.java View source code
static final int hexval(char c) throws java.io.IOException {
    switch(c) {
        case '0':
            return 0;
        case '1':
            return 1;
        case '2':
            return 2;
        case '3':
            return 3;
        case '4':
            return 4;
        case '5':
            return 5;
        case '6':
            return 6;
        case '7':
            return 7;
        case '8':
            return 8;
        case '9':
            return 9;
        case 'a':
        case 'A':
            return 10;
        case 'b':
        case 'B':
            return 11;
        case 'c':
        case 'C':
            return 12;
        case 'd':
        case 'D':
            return 13;
        case 'e':
        case 'E':
            return 14;
        case 'f':
        case 'F':
            return 15;
    }
    // Should never come here
    throw new java.io.IOException();
}
Example 29
Project: cloudtm-data-platform-master  File: XmlConfigurator.java View source code
public InputSource resolveEntity(String publicId, String systemId) throws IOException {
    if (systemId != null && systemId.startsWith("http://www.jgroups.org/schema/JGroups-")) {
        String schemaName = systemId.substring("http://www.jgroups.org/".length());
        InputStream schemaIs = getAsInputStreamFromClassLoader(schemaName);
        if (schemaIs == null) {
            throw new IOException("Schema not found from classloader: " + schemaName);
        }
        InputSource source = new InputSource(schemaIs);
        source.setPublicId(publicId);
        source.setSystemId(systemId);
        return source;
    }
    return null;
}
Example 30
Project: SimpleRep-master  File: DynAbcastReplacer.java View source code
public void interceptCall(DynAbcastCallParameters params, Message dmessage) {
    synchronized (this.parent) {
        try {
            dmessage.content = new SequencedMessage(dmessage.content, new TInteger(sendSeqNumber));
            undeliveredMessages.add((Message) deepClone(dmessage));
            undeliveredType.add(params.type);
            undeliveredPID.add(params.pid);
            forwardCall(params, dmessage);
        } catch (ClassNotFoundException ex) {
            throw new RuntimeException("Can not abcast this message!");
        } catch (IOException ex) {
            ex.printStackTrace();
            throw new RuntimeException("Can not abcast this message!" + ex.getMessage());
        }
    }
}
Example 31
Project: android_platform_libcore-master  File: Support_StringReader.java View source code
/**
     * Reads at most <code>count</code> characters from this StringReader and
     * stores them at <code>offset</code> in the character array
     * <code>buf</code>. Returns the number of characters actually read or -1
     * if the end of reader was encountered.
     *
     * @param buf
     *            character array to store the read characters
     * @param offset
     *            offset in buf to store the read characters
     * @param count
     *            maximum number of characters to read
     * @return the number of characters read or -1 if end of reader.
     *
     * @exception java.io.IOException
     *                If the StringReader is closed.
     */
@Override
public int read(char buf[], int offset, int count) throws IOException {
    // avoid int overflow
    if (0 <= offset && offset <= buf.length && 0 <= count && count <= buf.length - offset) {
        synchronized (lock) {
            if (isOpen()) {
                if (pos == this.count) {
                    return -1;
                }
                int end = pos + count > this.count ? this.count : pos + count;
                str.getChars(pos, end, buf, offset);
                int read = end - pos;
                pos = end;
                return read;
            }
            throw new IOException("StringReader is closed");
        }
    }
    throw new ArrayIndexOutOfBoundsException();
}
Example 32
Project: sosies-generator-master  File: CatchAndRethrowClosureTest.java View source code
@Test(timeout = 1000)
public void testThrowingClosure_add1225() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(), this, "testThrowingClosure_add1225");
    Closure<java.lang.Integer> closure = CatchAndRethrowClosureTest.generateNoExceptionClosure();
    try {
        closure.execute(Integer.valueOf(0));
        closure.execute(Integer.valueOf(0));
    } catch (final FunctorException ex) {
    } catch (final RuntimeException ex) {
    }
    closure = CatchAndRethrowClosureTest.generateIOExceptionClosure();
    try {
        closure.execute(Integer.valueOf(0));
    } catch (final FunctorException ex) {
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4442, ((ex.getCause()) instanceof java.io.IOException));
    } catch (final RuntimeException ex) {
    }
    closure = CatchAndRethrowClosureTest.generateNullPointerExceptionClosure();
    try {
        closure.execute(Integer.valueOf(0));
    } catch (final FunctorException ex) {
    } catch (final RuntimeException ex) {
        fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(), 4443, (ex instanceof java.lang.NullPointerException));
    }
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
Example 33
Project: JBossAS51-master  File: ClientMBeanServerConnection.java View source code
/**
    * Add a notification listener to an MBean.
    *
    * @param name     the name of the MBean broadcasting notifications
    * @param listener the listener to add
    * @param filter   a filter to preprocess notifications
    * @param handback a object to add to any notifications
    * @throws javax.management.InstanceNotFoundException
    *                             if the broadcaster is not registered
    * @throws java.io.IOException for a communication problem during this operation
    */
public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException {
    ClientListenerHolder holder = new ClientListenerHolder(name, listener, filter, handback);
    // properly registered as a listener and can ignore call
    if (clientNotifier.exists(holder)) {
        return;
    } else {
        MarshalledObject marshalledFilter = null;
        if (filter != null) {
            try {
                marshalledFilter = new MarshalledObject(filter);
            } catch (IOException e) {
                holder.setFilterOnClient(true);
            }
        }
        Integer[] listenerIDs = connection.addNotificationListeners(new ObjectName[] { name }, new MarshalledObject[] { marshalledFilter }, new Subject[] { subject });
        clientNotifier.addNotificationListener(listenerIDs[0], holder);
    }
}
Example 34
Project: jade_agents-master  File: ACLParserTokenManager.java View source code
private final int jjMoveStringLiteralDfa1_4(long active0) {
    try {
        curChar = input_stream.readChar();
    } catch (java.io.IOException e) {
        jjStopStringLiteralDfa_4(0, active0);
        return 1;
    }
    switch(curChar) {
        case 65:
        case 97:
            return jjMoveStringLiteralDfa2_4(active0, 0x8000000000000L);
        case 69:
        case 101:
            return jjMoveStringLiteralDfa2_4(active0, 0x1800000000000L);
        case 71:
        case 103:
            return jjMoveStringLiteralDfa2_4(active0, 0x2000000000000L);
        case 78:
        case 110:
            return jjMoveStringLiteralDfa2_4(active0, 0x4000000000000L);
        case 82:
        case 114:
            return jjMoveStringLiteralDfa2_4(active0, 0x10000000000000L);
        default:
            break;
    }
    return jjStartNfa_4(0, active0);
}
Example 35
Project: cloudbees-api-client-master  File: CloudResourceProvider.java View source code
/**
     * Lists up all the cloud resources.
     */
public Iterator<CloudResource> iterator() {
    try {
        JsonNode res = getOwner().retrieve().get("resources");
        if (res == null || !res.isArray())
            throw new IllegalStateException("Expected a JSON array but " + getOwner() + " gave us " + res);
        ReferencedResource[] dto = CloudResource.MAPPER.readValue(res, ReferencedResource[].class);
        List<CloudResource> r = new ArrayList<CloudResource>(dto.length);
        for (ReferencedResource rr : dto) {
            r.add(rr.toCloudResource(getOwner()));
        }
        return r.iterator();
    } catch (IOException e) {
        throw new Error(e);
    }
}
Example 36
Project: openmap-master  File: PNG8ImageFormatter.java View source code
public byte[] formatImage(BufferedImage bi) {
    BufferedImage reducedImage = null;
    if (bi.getColorModel().hasAlpha()) {
        reducedImage = ColorReducer.reduce32(bi, 256);
    } else {
        reducedImage = ColorReducer.reduce24(bi, 256);
    }
    try {
        ByteArrayOutputStream byo = new ByteArrayOutputStream();
        ImageIO.write(reducedImage, getFormatName(), byo);
        return byo.toByteArray();
    } catch (java.io.IOException e) {
        Debug.error("ImageIOFormatter caught IOException formatting image!");
        return new byte[0];
    }
}
Example 37
Project: Mint-Programming-Language-master  File: ExecuteJava.java View source code
@Override
public Pointer apply(SmartList<Pointer> args) throws MintException {
    String programName = PointerTools.dereferenceString(args.get(0));
    programName = programName.trim();
    String className = programName.replace(".java", "");
    if (!programName.endsWith(".java")) {
        programName += ".java";
    }
    try {
        Process jv = Runtime.getRuntime().exec("javac " + programName);
        Process jv2 = Runtime.getRuntime().exec("java " + className);
        BufferedReader in = new BufferedReader(new InputStreamReader(jv2.getInputStream()));
        String line = null;
        int i = 0;
        int limit = Integer.MAX_VALUE >>> 1;
        while (i < limit) {
            line = in.readLine();
            if (line == null) {
                break;
            }
            System.out.println(line);
            i++;
        }
    } catch (IOException ex) {
    }
    return Constants.MINT_NULL;
}
Example 38
Project: SRE-RoboCode-master  File: FileWriteSize.java View source code
public void run() {
    out.println("Data directory: " + getDataDirectory());
    out.println("Data quota: " + getDataQuotaAvailable());
    byte[] buf = new byte[100000];
    File file = null;
    RobocodeFileOutputStream rfos = null;
    try {
        file = getDataFile("test");
        out.println("Data file: " + file.getCanonicalPath());
        file.delete();
        rfos = new RobocodeFileOutputStream(file);
        for (int i = 0; i < 3; i++) {
            rfos.write(buf);
        }
    } catch (IOException e) {
        e.printStackTrace(out);
    } finally {
        if (rfos != null) {
            try {
                rfos.close();
            } catch (IOException e) {
                e.printStackTrace(out);
            }
        }
        if (file != null) {
            if (!file.delete()) {
                out.println("Could not delete the file: " + file);
            }
        }
    }
}
Example 39
Project: MyDownload-master  File: Utils.java View source code
public static String getRawData(String string) {
    String dataString = "";
    try {
        URL url;
        url = new URL(string);
        URLConnection conn = url.openConnection();
        // conn.connect();
        BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        byte buffer[] = new byte[1024];
        String readerString;
        while ((readerString = reader.readLine()) != null) {
            dataString += readerString;
        }
        reader.close();
    } catch (IOException e) {
        e.printStackTrace();
        log("IOException", "" + e);
    }
    log("getRawData", dataString);
    return dataString;
}
Example 40
Project: molgenis-master  File: XmlMolgenisUiLoader.java View source code
public Molgenis load() throws IOException {
    InputStream xsdStream = this.getClass().getResourceAsStream(UI_XSD);
    if (xsdStream == null)
        throw new IOException("unable to find " + UI_XSD);
    try {
        InputStream xmlStream = this.getClass().getResourceAsStream(UI_XML);
        if (xmlStream == null)
            throw new IOException("unable to find " + UI_XML);
        try {
            SchemaLoader schemaLoader = new SchemaLoader(xsdStream);
            Schema molgenisUiSchema = schemaLoader.getSchema();
            JAXBContext jaxbContext = JAXBContext.newInstance(Molgenis.class);
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            unmarshaller.setSchema(molgenisUiSchema);
            return unmarshaller.unmarshal(new StreamSource(xmlStream), Molgenis.class).getValue();
        } catch (JAXBException e) {
            throw new IOException(e);
        } finally {
            IOUtils.closeQuietly(xmlStream);
        }
    } finally {
        IOUtils.closeQuietly(xsdStream);
    }
}
Example 41
Project: hank-master  File: Hank.java View source code
public static String getProperty(String property) {
    try {
        Enumeration<URL> manifestStream = Hank.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
        if (!manifestStream.hasMoreElements()) {
            return "No Manifest";
        }
        while (manifestStream.hasMoreElements()) {
            Manifest manifest = new Manifest(manifestStream.nextElement().openStream());
            Attributes attributes = manifest.getMainAttributes();
            String title = attributes.getValue("Implementation-Title");
            if (title != null && isValidTitle(title)) {
                String temp = attributes.getValue(property);
                if (temp != null) {
                    return temp;
                } else {
                    return "Not in Manifest";
                }
            }
        }
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    return "Unknown";
}
Example 42
Project: MyFramework-master  File: FreeMarkerConfig.java View source code
/***�1�7
     * @param templateDirPath
     * @throws ConfigureException
     */
public void configureFreeMarker(String templateDirPath) throws Exception {
    if (null == templateDirPath || "".equals(templateDirPath)) {
        throw new Exception("FreeMarker template directory not exist:" + templateDirPath);
    }
    File templateDir = new File(templateDirPath);
    if (null == templateDir || !templateDir.exists() || !templateDir.isDirectory()) {
        throw new Exception("FreeMarker template directory not exist:" + templateDirPath);
    }
    // Configure the template engine
    Configuration templateCfg = new Configuration();
    try {
        BeansWrapper wrapper = BeansWrapper.getDefaultInstance();
        wrapper.setSimpleMapWrapper(true);
        wrapper.setExposureLevel(BeansWrapper.EXPOSE_ALL);
        templateCfg.setEncoding(Locale.CHINA, "utf-8");
        templateCfg.setObjectWrapper(wrapper);
        templateCfg.setDirectoryForTemplateLoading(templateDir);
        templateCfg.setNumberFormat("######################.##");
    } catch (IOException e) {
        throw new Exception("IOException occured when loading freemarker template:" + templateDirPath);
    }
    templateCfg.setTemplateUpdateDelay(2);
    Configuration.setDefaultConfiguration(templateCfg);
}
Example 43
Project: LambdaDojo-master  File: S205LambdaForStrategy.java View source code
private void useContainer() {
    Container<String> container = new Container<>("Hello, World!");
    container.output(new Consumer<String>() {

        @Override
        public void accept(String value) {
            System.out.println(value);
        }
    });
    final String filename = "container.txt";
    container.output(new Consumer<String>() {

        @Override
        public void accept(String value) {
            try {
                Path path = Paths.get(filename);
                Files.write(path, value.getBytes());
            } catch (IOException ex) {
                System.err.println("printに失敗しました");
            }
        }
    });
}
Example 44
Project: liferay-ide-master  File: FindJavaProblemsHandler.java View source code
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    try {
        Liferay7UpgradeAssistantSettings settings = UpgradeAssistantSettingsUtil.getObjectFromStore(Liferay7UpgradeAssistantSettings.class);
        String[] projectLocations = settings.getJavaProjectLocations();
        List<IPath> locations = new ArrayList<>();
        for (String projectLocation : projectLocations) {
            locations.add(new Path(projectLocation));
        }
        new MigrateProjectHandler().findMigrationProblems(locations.toArray(new IPath[0]));
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}
Example 45
Project: jdroid-master  File: CacheParser.java View source code
/**
	 * @see Parser#parse(java.io.InputStream)
	 */
@Override
public Object parse(InputStream inputStream) {
    final InputStream inputStreamCopy = FileUtils.copy(inputStream);
    Object object = parser.parse(inputStreamCopy);
    ExecutorUtils.execute(new Runnable() {

        @Override
        public void run() {
            try {
                inputStreamCopy.reset();
            } catch (IOException e) {
                LoggerUtils.logHandledException(LOGGER, e);
            }
            FileUtils.copyStream(inputStreamCopy, cacheFile);
            LOGGER.debug("Saved http request to cache file: " + cacheFile.getAbsolutePath());
        }
    });
    return object;
}
Example 46
Project: AudioPlayer-master  File: QianQianParser.java View source code
public static List<LyricResults> parseXml(String xml) {
    List<LyricResults> list = new ArrayList<LyricResults>();
    try {
        XmlPullParser xrp = XmlPullParserFactory.newInstance().newPullParser();
        xrp.setInput(new StringReader(xml));
        // 直到文档的结尾处
        while (xrp.getEventType() != XmlResourceParser.END_DOCUMENT) {
            // 如果遇到了开始标签
            if (xrp.getEventType() == XmlResourceParser.START_TAG) {
                String // 获取标签的名字
                tagName = // 获取标签的名字
                xrp.getName();
                if (tagName.equals("lrc")) {
                    LyricResults result = new LyricResults();
                    result.id = Integer.valueOf(// 通过属性名来获取属性值
                    xrp.getAttributeValue(// 通过属性名来获取属性值
                    0));
                    result.artist = // 通过属性索引来获取属性值
                    xrp.getAttributeValue(// 通过属性索引来获取属性值
                    1);
                    result.track = xrp.getAttributeValue(2);
                    list.add(result);
                }
            }
            // 获取解析下一个事件
            xrp.next();
        }
    } catch (XmlPullParserException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return list.size() == 0 ? null : list;
}
Example 47
Project: android-15-master  File: CarouselViewUtilities.java View source code
/**
     * Debug utility to write the given bitmap to a file.
     *
     * @param context calling context
     * @param bitmap the bitmap to write
     * @param filename the name of the file to write
     * @return
     */
public static boolean writeBitmapToFile(Context context, Bitmap bitmap, String filename) {
    File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
    File file = new File(path, filename);
    boolean result = false;
    try {
        path.mkdirs();
        OutputStream os = new FileOutputStream(file);
        MediaScannerConnection.scanFile(context, new String[] { file.toString() }, null, null);
        bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);
        result = true;
    } catch (IOException e) {
        Log.w("ExternalStorage", "Error writing " + file, e);
    }
    return result;
}
Example 48
Project: afwall-master  File: FAQFragment.java View source code
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    TextView text = (TextView) getActivity().findViewById(R.id.faq_afwall_title);
    text.setText(R.string.faq);
    WebView creditsWebView = (WebView) getActivity().findViewById(R.id.faq_webview);
    try {
        String data = Api.loadData(getActivity().getBaseContext(), "faq");
        creditsWebView.loadDataWithBaseURL(null, data, "text/html", "UTF-8", null);
    } catch (IOException ioe) {
        Log.e(TAG, "Error reading changelog file!", ioe);
    }
}
Example 49
Project: cafeUnoesc-master  File: ThreadTwitter.java View source code
@Override
public void run() {
    int i = 0;
    while (ativar) {
        try {
            System.out.println("........");
            System.out.println("Vericicação Nº " + i++);
            Util u = new Util();
            u.buscarTweet("@CafeUnoesc");
            Thread.sleep(5000);
        } catch (TwitterException ex) {
            Logger.getLogger(ThreadTwitter.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InterruptedException ex) {
            Logger.getLogger(ThreadTwitter.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnknownHostException ex) {
            Logger.getLogger(ThreadTwitter.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(ThreadTwitter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
Example 50
Project: tio_patinhas-master  File: CClienteSocket.java View source code
public CArquivosTeste RecebeArquivosTeste() {
    try {
        conCliente = new Socket(hostname, porta);
        // Pega Os Streams de Leitura e escrita
        // Essa parte deve ter algo parecido no servidor
        // na hora de receber/enviar os dados
        ois = new ObjectInputStream(conCliente.getInputStream());
        return (CArquivosTeste) ois.readObject();
    } catch (UnknownHostException ex) {
        Logger.getLogger(CClienteSocket.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(CClienteSocket.class.getName()).log(Level.SEVERE, null, ex);
    } catch (ClassNotFoundException ex) {
        Logger.getLogger(CClienteSocket.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}
Example 51
Project: classlib6-master  File: DGCImpl_Skel.java View source code
public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception {
    if (opnum < 0) {
        if (hash == -5803803475088455571L) {
            opnum = 0;
        } else if (hash == -8139341527526761862L) {
            opnum = 1;
        } else {
            throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
        }
    } else if (hash != interfaceHash) {
        throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
    }
    gnu.java.rmi.dgc.DGCImpl server = (gnu.java.rmi.dgc.DGCImpl) obj;
    switch(opnum) {
        case 0:
            {
                java.rmi.server.ObjID[] $param_0;
                long $param_1;
                java.rmi.dgc.VMID $param_2;
                boolean $param_3;
                try {
                    java.io.ObjectInput in = call.getInputStream();
                    $param_0 = (java.rmi.server.ObjID[]) in.readObject();
                    $param_1 = (long) in.readLong();
                    $param_2 = (java.rmi.dgc.VMID) in.readObject();
                    $param_3 = (boolean) in.readBoolean();
                } catch (java.io.IOException e) {
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } catch (java.lang.ClassCastException e) {
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } finally {
                    call.releaseInputStream();
                }
                server.clean($param_0, $param_1, $param_2, $param_3);
                try {
                    java.io.ObjectOutput out = call.getResultStream(true);
                } catch (java.io.IOException e) {
                    throw new java.rmi.MarshalException("error marshalling return", e);
                }
                break;
            }
        case 1:
            {
                java.rmi.server.ObjID[] $param_0;
                long $param_1;
                java.rmi.dgc.Lease $param_2;
                try {
                    java.io.ObjectInput in = call.getInputStream();
                    $param_0 = (java.rmi.server.ObjID[]) in.readObject();
                    $param_1 = (long) in.readLong();
                    $param_2 = (java.rmi.dgc.Lease) in.readObject();
                } catch (java.io.IOException e) {
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } catch (java.lang.ClassCastException e) {
                    throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
                } finally {
                    call.releaseInputStream();
                }
                java.rmi.dgc.Lease $result = server.dirty($param_0, $param_1, $param_2);
                try {
                    java.io.ObjectOutput out = call.getResultStream(true);
                    out.writeObject($result);
                } catch (java.io.IOException e) {
                    throw new java.rmi.MarshalException("error marshalling return", e);
                }
                break;
            }
        default:
            throw new java.rmi.UnmarshalException("invalid method number");
    }
}