File copy functionality implementation

I am giving two efficient ways of file copying functional implemantation.
     * Generic method to copy file from one location to other location
     * @param in : source file path name
     * @param out : destination file path name
     * @throws IOException
    public static void copyFile(String in, String out)
    throws Exception
        String copyCommand = "cmd /c copy "+in+" "+out;
        Process pr;
        try {
            pr = Runtime.getRuntime().exec(copyCommand);
            int exitValue = pr.waitFor();
        } catch (IOException e) {
            throw e;
        } catch (InterruptedException e) {
            throw e;
     }and
To copyFile using java.nic.io
    public static void copyFile(File in, File out)
    throws IOException
     FileChannel inChannel = new
         FileInputStream(in).getChannel();
     FileChannel outChannel = new
         FileOutputStream(out).getChannel();
     try {
         inChannel.transferTo(0, inChannel.size(),
                 outChannel);
     catch (IOException e) {
         throw e;
     finally {
         if (inChannel != null) inChannel.close();
         if (outChannel != null) outChannel.close();
7. // Copies src file to dst file.
// If the dst file does not exist, it is created
    void copy(File src, File dst) throws IOException {
        InputStream in = new FileInputStream(src);
        OutputStream out = new FileOutputStream(dst);
        // Transfer bytes from in to out
        byte[] buf = new byte[1024];
        int len;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        in.close();
        out.close();
    }

SomasekharPatil wrote:
still totally useless
It's truly terribleWe should never tell any thing like "useless" and "terrible"Yes we should. When there are multiple ways to solve a problem but one or two of them are much better than the third then the third is useless and terrible. There are more then enough terrible blogs and terrible sites (roseindia I'm looking at you) with more then enough terrible ideas and code samples that demonstrate how not to do things. Those sorts of "resources" only cause confusion among the naive and code that is messy, hacky and mostly just doesn't work.
Nothing is useless in this universe.You haven't seen enough code yet.
That method can also be used in requirements where it best suits! who knows what customer requirements are?What sort of requirement is it that is going to make that code useful?

Similar Messages

  • Any solutions to Apple's poor file copy function

    For many years Apple's OS - all versions on all computers does not have the intelligence to copy files from drive to drive.  Does anyone know of a different software program that can help the Apple OS do this simple task?
    A little more info - I have never been able to get any Apple product - all the way back to System 7 to be able to copy files unattended.  The latest annoying problem comes from a need to move files from my Thunderbolt 1 TB SSD drive to an attached Toshiba 2TB drive.  I have a folder with about 1500 photos that I need to move from the SSD to the Toshiba drive to clear up space on my SSD drive.  I am using my MB Pro with OS 10.9.5 with 16 GB ram and a 1 TB internal SSD drive and it does not matter if I select 5 files or 500 files, it never gets more than 20 files into the copy and then very stupidly thinks some random file is in use.  No Apple OS has the intelligence to think that if this one file can't be copied at this time, that it should continue the copy operation.  The copy process shuts down then I have to look file by file to see which files it did successfully copy.  Then delete the files on the drive and select another 50 files and get another 4 or 5 copied and then do it again and again and again and again, etc... 
    I have the same problem using my Mac Pro workstation with 32 GB ram, the same problem on all 4 of my MbPro notebooks.  The problem is 100% within Apple's OS.  Obviously none of the files are ever in use.  Also, rebooting the computer does not change the situation.  Problem has existed since my PowerMac 8100/80.  It would be nice to see Apple address this problem or someone else write a basic file copy program that works.
    Thanks
    George

    Mark
    Appreciate your observations but there are a couple of issues at point
    #1 - The OS incorrectly thinks a file is in use when it is not.  It does not matter if I select and copy or drag and drop.  Minutes later the same file will usually copy.  Does not matter if it is an image from the iphone or a word doc or excel file or a video file.
    #2 - The OS is incapable of continuing a copy function when it has incorrectly told itself that a file is in use.  A superior file copy function would flag the error and continue copying.  No idea why Apple has not fixed this about a decade ago.  It has to be deeply embedded in their system software.
    The issue is the same if it is with an original Mac Pro copying between internal hard drives or involving external hard drives or a NAS drive.  It has plagued me for a very long time.  As I find hard drives that I want to move everything off of so I can reformat or replace I have to go through this painful ordeal which involves initiating the copy function hundreds of times.  I have almost finished copying 657 photos that were copied from my iPhone to the SSD drive and I wanted to get them off the SSD drive.  It took several hours yesterday and I have been at it for about 4 hours tonight.  It sure seems like it should be as easy as dragging the folder from one drive to the other and it would be if there was some way to disable that stupid "file in use" error in the Apple OS.
    Thanks
    George

  • How can I get a file to copy all of the files in a directory except itself and the source of the copy function will be the directory the final program is in?

    How can I get a file to copy all of the files in a directory except itself and the source of the copy function will be the directory the final program is in? This application must be in Lab View 8.

    you mean something like this (see below)?
    Now you may have to implement code to check if the destination folder exists and to create it, etc.  But if you use the Front Panel Control to select the destination folder, it should be okay.
    Not the best implementation, mind you but you'll get the idea..
    Message Edited by JoeLabView on 04-18-2007 03:43 PM
    Attachments:
    copy folder contents.PNG ‏10 KB

  • Preserving Current Owner file permissions using the copy function

    I've been trying to use ARD 3's Copy function to overwrite a single user's Home folder in a classroom environment made up of a few Macs.
    This is done with the aim of refreshing the Home folder every time a class is concluded.
    However, although the Copy function works and succeeds in overwriting the Home folder, when the client is logged in locally, all the applications suffer from permission issues.
    I've tried both the; Inherit from destination folder and; (ii) Preseve current owner, file permissions in the "Set item ownership to" option of the Copy window but neither appear to work.
    I've also attempted to mirror the target user's account by creating the same account on the admin machine to push the Home folder over but the permissions remain a mess later.
    Is there a way to get around this without having to implement lengthy UNIX commands?
    I know of the existence of remote management apps, e.g. Deep Freeze (http://www.faronics.com/html/DFMac.asp), but under a budget constraint, such options are undesirable at the moment.
    PowerBook G4   Mac OS X (10.4.3)  

    Drag the photo from the iPhoto window to the desktop or export as kind = JPEG
    As to too small - what is too small?  The pixel dimensions of the exported JPEG will be identical to the original TIFF - the file size is smaller because JPEGs are compressed - which of course reduces file size - which of course is the reason that JPEG exists
    LN

  • Copy Function Doesn't Work After Updating user.js File

    I tried the Copy Function at the web site www.gogvo.com and got an error message from Firefox that Copy wasn't enabled. I got more info and created a user.js file in my Profile with the above site inserted following directions on the Troubleshooting Help page. I restarted Firefox but still can't use the Copy Function when I right-click a highlighted field to Copy. I have no problem when I use Internet Explorer 9 with my Windows 7 Home Premium. I have the latest version of Firefox. I have no problem copying on other sites, such as MSN Hotmail.

    I tried {Ctrl+C} and that doesn't work. I deleted the user.js file and downloaded the allowclipboard-helper file extension, and that doesn't work. I only have this Copy/Paste problem HERE: [http://www.gogvo.com/affiliates/optin_message.php GVO Responder Opt-in Message Edit] and don't have any Copy/Paste problems anywhere else. Is there another solution to try?

  • How to implement copy functionality in advanced table

    hi all, i have a advanced table with some data populated, all the rows has a checkbox where the user can select the rows which he wants, my requirement is how to implement copy functionality, i,e i need to show the same set of rows which the user selected in the same advanced table. can any one give me an idea of how to do this

    You can copy the key of the selected rows to the copy page and based on those keys render the rows. On this copy page, once user commits after any modification to data, read those rows and save with new keys.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to Disable Save and Save a Copy functions in a PDF file

    I would like to know how to disable the Save and Save a Copy functions. I have a client that does not want the ability to save for there customers. I also need to make sure that it can not be changed by there customer. 
    Any suggestions would be greatly helpful.
    Thanks
    Andrew

    Once the PDF is viewed on a machine it is already saved there. That is why it is not possible. The only option is to not allow folks to have the PDF at all. You can disable the ability to copy information from the PDF or use SAVE as to put it in a different form without the security. Those are the security features that are available, but with the caveat that many 3rd party products ignore the PDF security and thus your efforts are not warrented if you want true security. The only way to get full security is through a fancy online (and costly) solution.

  • File Copy times

    My newsreader is acting funny and dropping posted messages, so I
    apologize if this shows up twice.
    My comments on the file speed are that the times posted by other just go
    to show how difficult it sometimes is to make good timing measurements.
    I suspect that the wide variations being posted are in large part to
    disk caching. To measure this, you should either flush the caches each
    time or run them multiple times to make sure that the cache affects them
    more equally.
    Here is what I'd expect. The LV file I/O is a thin layer built upon the
    OS file I/O. Any program using file I/O will see that smaller writes
    have somewhat more overhead than a few large writes. However, at some
    size, either LV or the OS will break the larger writes into smaller
    ones. The file I/O functions in general will be slower to read and
    write contents than making a file copy using the copy node or move node.
    Sorry if I can't be more specific, but if you have a task that
    seems way to slow, please send it to technical support and report a
    performance problem. If we can find a better implementation, we will
    try to integrate it.
    Greg McKaskle

    Maybe this is because of the write buffer?
    Try mounting the media using the -o sync option to have data written immediately.

  • Importing, copyping raw files as DNG files - copy to location choice, and more ???

    First:
    When I copy raw files as DNG files, the right hand pane shows where the copies will be placed.  (I use Windows 7) I do not have much of a choice, and cannot set a default.  The default choice is "My Pictures" on the C: drive.  I have an Solid State Drive, SSD, and do NOT store my photos on that small, 256Gb drive.  I store my images on an internal hard drive. 
    All i want to do is set the default "Copy To" location to where I store my images.  I would like to copy them to the original folder, in a separate folder (for example, LR DNG).  Instead, I have to open the SSD, find the files, and copy them to my preferred location.  This is very irritating.
    Second:
    Worst, it appears that the Copy function puts the copied images into multiple folders.  I had 11 images from raw files that were put into three separate folders.  That seems quite silly to me.  It causes me to do more work opening the folders and copying them to the root folder.  That is very irritating.   What is going on here?
    can these two issues be resolved? Thanks, in advance.

    My apologies.  I thought it would open the selected folder and reveal the images to be converted.  That would be the most obvious thing to do, but it does not behave that way.  I made a couple folders with test images, CR2 and RW2, and the converter converted them. 
    Again, the navigation was funky, inconvenient, but it works.  i complain because we pay a lot of money to use Adobe products, they have huge resources, and  they seem to release products that have obvious flaws, especially navigation.  Maybe they just hate Microsoft.  Sorry for the rant.
    Thanks for getting me to use DNG converter. 

  • Copy function not working in nw2004s-ip

    Hi,
    I am using NW2004s BI-Integrated Planning. I am using the Planning Modeler tool.
    I am trying to create a copy function to copy actual data from 2006 to become plan data for 2007.
    There are no variables involved. I have specified the infoprovider, fiscal year/period and value type for reporting.
    The copy function reads as:
    FROM :
    Fiscal year / period: 001.2006; InfoProvider: CO-OM-CCA: Costs and Allocations; Value Type for Reporting: Actual
    TO:
    Fiscal year / period: 001.2007; InfoProvider: Plan Data; Value Type for Reporting: Plan
    The fiscal year/period value chosen in both cases is a V3 variant.
    I get the same error message every time
    " Inconsistent time characteristics: 0FISCPER,V3/001.2007 and 0FISCYEAR,V3/2006"
    Ultimately I want to copy to all periods of 2006 to 2007, but to get something working would be nice!
    What am I doing wrong?
    Any suggestions gratefully received (and points given).

    Hi Dave,
    We are experiencing the same problem. We've just implemented BW-IP and we are trying to configure through the Modeler a simple copy function from 0cca_c11 to a transactional InfoCube with plan data. Also changing characteristics as: 0fiscyear, 0vtype, 0version and nothing else, both InfoCubes are selected in the filter area, and I think the Multiprovider that we've created in BW is ok. Everything seems to be so straight forward but .. .nothing is working (we had this working in the previous BW-BPS).
    Can someone give us a hint of what we may be doing wrong, or a kind of checklist of the things that we have to validate so as to be sure to get this working.?
    (tips about the multiprovider in bw? , tips about the filter options?, tips aobut the copy function parameters?)
    Regards,
    Andrea.

  • Request - AI files copy & Curved in different folder

    Dear Participants...
    Is it possible with javascript code to do the following?
    Have AI files from different paths. I need a copy all files with text curves. Should work for batch.
    In the given path one folder should cretae called 'Curved" and all the files need copy to that folder and add file name at end '_Curved'
    For example: file name is 'Filename.ai'. It should come 'Filename_Curved.ai'
    Using Adobe CS4
    if you help me that would be really grateful...
    Thanks in advance..

    I prefer to script than work… Anyhow's I gave this a quick test here and it works fine for me…
    #target illustrator
    var df = Folder('~/Desktop');
    var aiFolder = Folder.selectDialog('Please choose your AI Folder…', df);
    if (aiFolder != null) {
         fileList = aiFolder.getFiles(/\.ai$/i);
         if (fileList.length > 0) {
              curveFolder = Folder(aiFolder.fsName+'/Curved')
              if (!curveFolder.exists) curveFolder.create();
              aiProcess();
         } else {
              alert('This Folder contained NO Illustrator AI files?');
    function aiProcess() {
         var uIL = app.userInteractionLevel;
         app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
         for (var i = 0; i < fileList.length; i++) {
              app.open(fileList[i]);
              var docRef = app.activeDocument;
              recurseLayers(docRef.layers);
              var docName = docRef.name.replace(/\.ai$/i,'');
              aiFilePath = File(curveFolder.fsName+'/'+docName+'_Curved.ai');
              var aiOpts = saveAsAiFile();
              docRef.saveAs(aiFilePath, aiOpts);
              docRef.close(SaveOptions.DONOTSAVECHANGES);
         app.userInteractionLevel = uIL;
    function saveAsAiFile() {
         var aiOpts = new IllustratorSaveOptions();
         with (aiOpts) {
              compatibility = Compatibility.ILLUSTRATOR12;
              compressed = true;
              embedICCProfile = true;
              embedLinkedFiles = true;
              flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
              fontSubsetThreshold = 0;
              overprint = PDFOverprint.PRESERVEPDFOVERPRINT;
              pdfCompatible = true;
         return aiOpts;
    function recurseLayers(objArray) {
         for (var i = 0; i < objArray.length; i++) {
              var l = objArray[i].locked;
              if (l) objArray[i].locked = false;
              var v = objArray[i].visible;
              if (!v) objArray[i].visible = true;
              outlineText(objArray[i].textFrames);
              if (objArray[i].layers.length > 0) {
                   recurseLayers(objArray[i].layers)
              if (objArray[i].groupItems.length > 0) {
                   recurseGroups(objArray[i].groupItems)
              objArray[i].locked = l;
              objArray[i].visible = v;
    function recurseGroups(objArray) {
         for (var i = 0; i < objArray.length; i++) {
              var l = objArray[i].locked;
              if (l) objArray[i].locked = false;
              var h = objArray[i].hidden;
              if (h) objArray[i].hidden = false;
              outlineText(objArray[i].textFrames);
              if (objArray[i].groupItems.length > 0) {
                   recurseGroups(objArray[i].groupItems)
              objArray[i].locked = l;
              objArray[i].hidden = h;
    function outlineText(objArray) {
         for (var i = objArray.length-1; i >= 0; i--) {
              var l = objArray[i].locked;
              if (l) objArray[i].locked = false;
              var h = objArray[i].hidden;
              if (h) objArray[i].hidden = false;
              var g = objArray[i].createOutline();
              g.locked = l;
              g.hidden = h;    
    There is a line '61' in my ESTK where you may want to change the version number it would be '15' for CS5…

  • Copy function results in Error 1430 when the target path terminal is &ltNot A Path

    Hello all.
    I'm having a little bit of trouble with the Copy function under LabView 8.2.  If I wire <Not A File> to the target path terminal, I get an Error 1430 (The path is empty or relative.) from the Copy File function's error out terminal.  According the the manual, wiring <Not a File> to the target path terminal should cause the Copy function to display a dialog box prompting the user to select a file.
    I've attached a sample VI which demonstrates this issue.  Is the documentation for the Copy function incorrect, or is something I'm doing wrong in my VI causing the error?
    Thanks,
    Mark Moss
    Attachments:
    copy.vi ‏16 KB

    Hi Mark,
    Thanks for bring this to our attention. I believe the documentation is incorrect here, as you suggested. When nothing is wired to the target path terminal, it behaves as expected (prompting the user to select a target directory).
    I will look into this further and report this issue to our LabVIEW documentation team.
    Sam
    -Sam F, DAQ Marketing Manager
    Learn about measuring temperature
    Learn how to take voltage measurements
    Learn how to measure current

  • Speeding up FileIO - Double Buffered File Copy?

    We are trying to speed up file copy from disk to tape, and I need a little more speed. I have tried playing with the size of the buffer, but that isn't changing much (makeing it slower if anything).
    I'm trying to make a double buffered file copy and I can't figure out how to do it. I figured this would be a good place to get speed. Right now, my write is very simple:
    byte buffer = new buffer[8 * 1024 * 1024];
    FileInputStream in = new FileInputStream(srcFile);
    while(true) {
      int amountRead = in.read(buffer);
      if (amountRead == -1) { break; }
      write(buffer, 0, length);
    }So what i need to do it be able to read and write at the same time. So I was thinking that I could either make the write method a sperate thread, or some how make threaded buffers that read while the other is being writen. Has anyone tackled this problem before?
    If this isn't the right way to speed up File IO, can you let me know other ideas? Thanks in advance!
    Andrew

    Once again: I wish I could claim credit for these classes, but they were in fact posted a year or so ago by someone lese. If I had the name I would give credit.
    I've used these for two heavy-duty applications with never a problem.
    <code>
    package pipes;
    import java.io.IOException;
    import java.io.InputStream;
    * This class is equivalent to <code>java.io.PipedInputStream</code>. In the
    * interface it only adds a constructor which allows for specifying the buffer
    * size. Its implementation, however, is much simpler and a lot more efficient
    * than its equivalent. It doesn't rely on polling. Instead it uses proper
    * synchronization with its counterpart PipedOutputStream.
    * Multiple readers can read from this stream concurrently. The block asked for
    * by a reader is delivered completely, or until the end of the stream if less
    * is available. Other readers can't come in between.
    public class PipedInputStream extends InputStream {
    byte[] buffer;
    boolean closed = false;
    int readLaps = 0;
    int readPosition = 0;
    PipedOutputStream source;
    int writeLaps = 0;
    int writePosition = 0;
    * Creates an unconnected PipedInputStream with a default buffer size.
    * @exception IOException
    public PipedInputStream() throws IOException {
    this(null);
    * Creates a PipedInputStream with a default buffer size and connects it to
    * source.
    * @exception IOException It was already connected.
    public PipedInputStream(PipedOutputStream source) throws IOException {
    this(source, 0x10000);
    * Creates a PipedInputStream with buffer size <code>bufferSize</code> and
    * connects it to <code>source</code>.
    * @exception IOException It was already connected.
    public PipedInputStream(PipedOutputStream source, int bufferSize) throws IOException {
    if (source != null) {
    connect(source);
    buffer = new byte[bufferSize];
    * Return the number of bytes of data available from this stream without blocking.
    public int available() throws IOException {
    // The circular buffer is inspected to see where the reader and the writer
    // are located.
    return writePosition > readPosition ? // The writer is in the same lap.
    writePosition - readPosition : (writePosition < readPosition ? // The writer is in the next lap.
    buffer.length - readPosition + 1 + writePosition :
    // The writer is at the same position or a complete lap ahead.
    (writeLaps > readLaps ? buffer.length : 0)
    * Closes the pipe.
    * @exception IOException The pipe is not connected.
    public void close() throws IOException {
    if (source == null) {
    throw new IOException("Unconnected pipe");
    synchronized (buffer) {
    closed = true;
    // Release any pending writers.
    buffer.notifyAll();
    * Connects this input stream to an output stream.
    * @exception IOException The pipe is already connected.
    public void connect(PipedOutputStream source) throws IOException {
    if (this.source != null) {
    throw new IOException("Pipe already connected");
    this.source = source;
    source.sink = this;
    * Closes the input stream if it is open.
    protected void finalize() throws Throwable {
    close();
    * Unsupported - does nothing.
    public void mark(int readLimit) {
    return;
    * returns whether or not mark is supported.
    public boolean markSupported() {
    return false;
    * reads a byte of data from the input stream.
    * @return the byte read, or -1 if end-of-stream was reached.
    public int read() throws IOException {
    byte[] b = new byte[0];
    int result = read(b);
    return result == -1 ? -1 : b[0];
    * Reads data from the input stream into a buffer.
    * @exception IOException
    public int read(byte[] b) throws IOException {
    return read(b, 0, b.length);
    * Reads data from the input stream into a buffer, starting at the specified offset,
    * and for the length requested.
    * @exception IOException The pipe is not connected.
    public int read(byte[] b, int off, int len) throws IOException {
    if (source == null) {
    throw new IOException("Unconnected pipe");
    synchronized (buffer) {
    if (writePosition == readPosition && writeLaps == readLaps) {
    if (closed) {
    return -1;
    // Wait for any writer to put something in the circular buffer.
    try {
    buffer.wait();
    catch (InterruptedException e) {
    throw new IOException(e.getMessage());
    // Try again.
    return read(b, off, len);
    // Don't read more than the capacity indicated by len or what's available
    // in the circular buffer.
    int amount = Math.min(len,
    (writePosition > readPosition ? writePosition : buffer.length) - readPosition);
    System.arraycopy(buffer, readPosition, b, off, amount);
    readPosition += amount;
    if (readPosition == buffer.length) {
    // A lap was completed, so go back.
    readPosition = 0;
    ++readLaps;
    // The buffer is only released when the complete desired block was
    // obtained.
    if (amount < len) {
    int second = read(b, off + amount, len - amount);
    return second == -1 ? amount : amount + second;
    } else {
    buffer.notifyAll();
    return amount;
    package pipes;
    import java.io.IOException;
    import java.io.OutputStream;
    * This class is equivalent to java.io.PipedOutputStream. In the
    * interface it only adds a constructor which allows for specifying the buffer
    * size. Its implementation, however, is much simpler and a lot more efficient
    * than its equivalent. It doesn't rely on polling. Instead it uses proper
    * synchronization with its counterpart PipedInputStream.
    * Multiple writers can write in this stream concurrently. The block written
    * by a writer is put in completely. Other writers can't come in between.
    public class PipedOutputStream extends OutputStream {
    PipedInputStream sink;
    * Creates an unconnected PipedOutputStream.
    * @exception IOException
    public PipedOutputStream() throws IOException {
    this(null);
    * Creates a PipedOutputStream with a default buffer size and connects it to
    * <code>sink</code>.
    * @exception IOException It was already connected.
    public PipedOutputStream(PipedInputStream sink) throws IOException {
    this(sink, 0x10000);
    * Creates a PipedOutputStream with buffer size <code>bufferSize</code> and
    * connects it to <code>sink</code>.
    * @exception IOException It was already connected.
    public PipedOutputStream(PipedInputStream sink, int bufferSize) throws IOException {
    if (sink != null) {
    connect(sink);
    sink.buffer = new byte[bufferSize];
    * Closes the input stream.
    * @exception IOException The pipe is not connected.
    public void close() throws IOException {
    if (sink == null) {
    throw new IOException("Unconnected pipe");
    synchronized (sink.buffer) {
    sink.closed = true;
    flush();
    * Connects the output stream to an input stream.
    * @exception IOException The pipe is already connected.
    public void connect(PipedInputStream sink) throws IOException {
    if (this.sink != null) {
    throw new IOException("Pipe already connected");
    this.sink = sink;
    sink.source = this;
    * Closes the output stream if it is open.
    protected void finalize() throws Throwable {
    close();
    * forces any buffered data to be written.
    * @exception IOException
    public void flush() throws IOException {
    synchronized (sink.buffer) {
    // Release all readers.
    sink.buffer.notifyAll();
    * writes a byte of data to the output stream.
    * @exception IOException
    public void write(int b) throws IOException {
    write(new byte[] {(byte) b});
    * Writes a buffer of data to the output stream.
    * @exception IOException
    public void write(byte[] b) throws IOException {
    write(b, 0, b.length);
    * writes data to the output stream from a buffer, starting at the named offset,
    * and for the named length.
    * @exception IOException The pipe is not connected or a reader has closed
    * it.
    public void write(byte[] b, int off, int len) throws IOException {
    if (sink == null) {
    throw new IOException("Unconnected pipe");
    if (sink.closed) {
    throw new IOException("Broken pipe");
    synchronized (sink.buffer) {
         if (sink.writePosition == sink.readPosition &&
         sink.writeLaps > sink.readLaps) {
         // The circular buffer is full, so wait for some reader to consume
         // something.
         try {
         sink.buffer.wait();
         catch (InterruptedException e) {
         throw new IOException(e.getMessage());
         // Try again.
         write(b, off, len);
         return;
         // Don't write more than the capacity indicated by len or the space
         // available in the circular buffer.
         int amount = Math.min(len,
         (sink.writePosition < sink.readPosition ?
         sink.readPosition : sink.buffer.length)
    - sink.writePosition);
         System.arraycopy(b, off, sink.buffer, sink.writePosition, amount);
         sink.writePosition += amount;
         if (sink.writePosition == sink.buffer.length) {
         sink.writePosition = 0;
         ++sink.writeLaps;
         // The buffer is only released when the complete desired block was
         // written.
         if (amount < len) {
         write(b, off + amount, len - amount);
         } else {
         sink.buffer.notifyAll();
    </code>

  • Apps don't launch or work after Copy Function

    Howdy,
    I'm having another issue with ARD 3.
    I've just rolled out StuffIt Expander 11 to all my Tiger Clients via ARD's Copy Function. The copy function works fine and it does copy the app to the destination, which is the Applications Folder.
    The app launches on the client machine but if I drop an archive to expand, the app [StuffIt] does nothing. It accepts the focus that a file drop is about to occur. But it doesn't expand nor error.
    If I copy the file locally on the client machine itself from the vendor's dmg file. The app runs the way it should. StuffIt Expander 11 dmg's is a 'Copy to App' installer as opposed to a pkg or Vise Installer.
    I'm assuming this is clearly a owner/group rwx issue.
    I checked using ls -l and BatChmod for permissions. All seem to be the same, Target and Source.
    Is the Copy funtion only limited to Apple Branded apps, such as the misleading Installer Function in ARD?
    Anyone else?
    Motshakeran

    Me again.
    Ok this is not solved. But managed to find a work around.
    I found a great app called Iceberg, which I find better than Apple's Package Maker.
    What I did was manually install a good working StuffIt Expander 11.app onto a mac and verified that it work. Then, I created a .pkg file using Iceberg and installed via ARD's Install Function ... and viola.. StuffIt Expander 11 works as it should to.
    So clearly, this is a bug with ARD's Copy Function. I think, imho, the Copy Function fracks up something when it does copy. Maybe it's good with only single documents.
    Anyone else.
    Q'pla!

  • Remote file copy

    I am just searching for some brief insight...
    I have a need to develop a "function" for a project we are working on that will allow a user to copy a file on a remote compute server (UNIX) to their local machine (WIN32). Ideally, I would like the user just to provide a hostname, path and filename of the file to be copied (similar to the rcp command on UNIX and WIN32 systems).
    I realize that I could probably accomplish this using Socket communication, however, there are X number of compute servers and it is not entirely reasonable to put server code on every server (I hope that makes sense). Ideally, I would like to have no code residing on the server side... Additionally, I can not make use of the URL class and methods either because the files are not located in "web space" on the remote servers...
    Any thoughts or suggestions... I am semi-new to Java and am wondering if there is a way to do this... thats all... and maybe a little insight on which direction to take (i.e pseudo code) if at all possible.
    At last if what I want to do is "impossible" without a server piece then I guess I can issue a system level call to the WIN32 rcp command... but this is strongly undesired by our computer security people.
    Essentially, all I want to do is to create my own RCP (remote copy) function via Java code rather than using the native win32 and UNIX rcp functions.
    Any help is greatly appreciated... Thanks in advance for any insight.
    Regards.
    echardrd

    You may try using the FTP server on unix machine for downloading to Windows. There are quite a lot of FTP library packages are available for Java. U can search for the right one and use it.

Maybe you are looking for

  • How to Invoke a report from java?

    Hi, I am a java / web developer with no reports experience. We wish do the following from a java based web application: On a web page we have two buttons 1) Print 2) Create file. We want these two buttons to perform the following tasks: 1) The print

  • How can I display multiple column results of a sql query?

    I'm wanting to display the results of a query selecting from multiple columns, but I can't seem to find an item type that will allow this. I've tried LOV, multiselect, display as text and others. Any ideas on how to do this. Here is my basic query: S

  • ISE NFR Allowed protocols

    Hi all, I am trying to configure ISE NFR (installed on vmWare) - I had to start from the only available NFR version 1.0 - so I first made upgrade to version 1.1.1(acording to release notes there should be no problem with stright upgrade) then applyed

  • How do I know if iCloud really backed up my stuff?

    I have recently backed up my stuff with Icloud again and I have less stuff now then I did before but the number of GB has always been the same and has never changed. Does this mean it didnt back up my stuff?

  • How do I set the range of pitch bend for the EFM-1?

    Hi folks, I have a simple patch for my EFM-1 and I want to apply a pitch bend in Mainstage.  It is presently set up to go a whole step up or down when the pitch bend is pushed all the way up (or down).  I probably set it up that way.....but I can't f