Examples of StreamReader


Examples of au.edu.mq.comp.common.concurrency.StreamReader

        //System.out.println("going to run java class with command -->" + command);
        //System.out.println("current working dir for command is -->" + this.pathToClass);
        java.lang.Process p = pb.start();
       
        int exitCode = -1;
        StreamReader outputStreamReader = new StreamReader(p.getInputStream());
        StreamReader errorStreamReader = new StreamReader(p.getErrorStream());
        outputStreamReader.start();
        errorStreamReader.start();
        if(timeOutInMillisec > 0)
        {
            Timer timer = null;
            try
            {
                timer = new Timer(true);
                InterruptTimerTask interrupter = new InterruptTimerTask(Thread.currentThread());
                timer.schedule(interrupter, timeOutInMillisec);
                exitCode = p.waitFor();
            }
            catch(InterruptedException e)
            {
                // do something to handle the timeout here
                Log.message("going to kill process with hashcode " + p.hashCode());
                p.destroy();
                exitCode = JavaClassRunner.kWaitForProcessTimeout;
                Log.message("process with hashcode " + p.hashCode() + " killed");
            }
            finally
            {
                timer.cancel();
                Thread.interrupted();
            }
        }
        else
        {
            exitCode = p.waitFor();
        }
        this.outputString = outputStreamReader.toString();
        this.errorString = errorStreamReader.toString();
        return exitCode;
    }
View Full Code Here

Examples of ch.pterrettaz.jmess.core.ReaderHelper.StreamReader

  @Override
  public Set<Data> extract(final String location, InputStream stream) throws IOException {
    final Set<Data> results = Sets.newHashSet();

    ReaderHelper.readStream(stream, new StreamReader() {
      @Override
      public void read(InputStream stream) throws IOException {
        Properties props = new Properties();
        props.load(stream);
        Enumeration<?> names = props.propertyNames();
View Full Code Here

Examples of ch.pterrettaz.jmess.core.ReaderHelper.StreamReader

            zipLocation = potentialFile.getName(); // keep only the filename
        } else {
            zipLocation = location;
        }
        final Set<Data> results = Sets.newHashSet();
        ReaderHelper.readStream(stream, new StreamReader() {
            @Override
            public void read(InputStream stream) throws IOException {
                ZipInputStream zip = new ZipInputStream(stream);
                for (ZipEntry en = null; (en = zip.getNextEntry()) != null;) {
                    if (extractor.canExtract(en.getName())) {
View Full Code Here

Examples of com.drew.lang.StreamReader

    public static JpegSegmentData readSegments(@NotNull File file, @Nullable Iterable<JpegSegmentType> segmentTypes) throws JpegProcessingException, IOException
    {
        FileInputStream stream = null;
        try {
            stream = new FileInputStream(file);
            return readSegments(new StreamReader(stream), segmentTypes);
        } finally {
            if (stream != null) {
                stream.close();
            }
        }
View Full Code Here

Examples of com.drew.lang.StreamReader

            for (JpegSegmentType type : reader.getSegmentTypes()) {
                segmentTypes.add(type);
            }
        }

        JpegSegmentData segmentData = JpegSegmentReader.readSegments(new StreamReader(inputStream), segmentTypes);

        processJpegSegmentData(metadata, readers, segmentData);
    }
View Full Code Here

Examples of com.drew.lang.StreamReader

    @NotNull
    public static Metadata readMetadata(@NotNull InputStream inputStream)
    {
        Metadata metadata = new Metadata();
        new GifReader().extract(new StreamReader(inputStream), metadata);
        return metadata;
    }
View Full Code Here

Examples of com.drew.lang.StreamReader

    @NotNull
    public static Metadata readMetadata(@NotNull InputStream inputStream)
    {
        Metadata metadata = new Metadata();
        new BmpReader().extract(new StreamReader(inputStream), metadata);
        return metadata;
    }
View Full Code Here

Examples of com.drew.lang.StreamReader

    public static List<PngChunk> processFile(String filePath) throws PngProcessingException, IOException
    {
        FileInputStream inputStream = null;
        try {
            inputStream = new FileInputStream(filePath);
            return Iterables.toList(new PngChunkReader().extract(new StreamReader(inputStream), null));
        } finally {
            if (inputStream != null) {
                inputStream.close();
            }
        }
View Full Code Here

Examples of com.drew.lang.StreamReader

    @NotNull
    public static BmpHeaderDirectory processBytes(@NotNull String file) throws Exception
    {
        Metadata metadata = new Metadata();
        InputStream stream = new FileInputStream(file);
        new BmpReader().extract(new StreamReader(stream), metadata);
        stream.close();

        BmpHeaderDirectory directory = metadata.getDirectory(BmpHeaderDirectory.class);
        assertNotNull(directory);
        return directory;
View Full Code Here

Examples of com.drew.lang.StreamReader

    @NotNull
    public static GifHeaderDirectory processBytes(@NotNull String file) throws Exception
    {
        Metadata metadata = new Metadata();
        InputStream stream = new FileInputStream(file);
        new GifReader().extract(new StreamReader(stream), metadata);
        stream.close();

        GifHeaderDirectory directory = metadata.getDirectory(GifHeaderDirectory.class);
        assertNotNull(directory);
        return directory;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.