Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.

Ticket #2908: down.java

File down.java, 1.1 KB (added by jmoore, 14 years ago)

Simple example of what produced a 0-sized download.

Line 
1import java.io.*;
2import omero.*;
3import omero.api.*;
4import omero.grid.*;
5import omero.model.*;
6import static omero.rtypes.*;
7
8public class down {
9    public static void main(String[] args) throws Exception {
10        client c = new client();
11        try {
12            ServiceFactoryPrx sf = c.createSession();
13            SharedResourcesPrx sr = sf.sharedResources();
14            TablePrx table = sr.newTable(1, "test.h5");
15
16            if (table == null) {
17                throw new RuntimeException("Null table");
18            }
19
20            OriginalFile file = null;
21            try {
22                file = table.getOriginalFile();
23                LongColumn lc = new LongColumn("a1","desc",new long[]{1l});
24                table.initialize(new Column[]{lc});
25                table.addData(new Column[]{lc});
26            } finally {
27                table.close();
28            }
29
30            if (file == null) {
31                throw new RuntimeException("Null file");
32            }
33
34            c.download(file.getId().getValue(), new File("test.h5"));
35
36        } finally {
37            c.closeSession();
38        }
39    }
40}

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.20327 sec.)

We're Hiring!