Search in sources :

Example 56 with Enumeration

use of java.util.Enumeration in project bigbluebutton by bigbluebutton.

the class Mixer method newOutputLine.

/** Adds a new output line. */
public InputStream newOutputLine(Object id) throws IOException {
    //System.err.println("Mixer: add output line: "+id);
    MixerLine ml = new MixerLine(id);
    for (Enumeration e = splitter_lines.keys(); e.hasMoreElements(); ) {
        Object sid = e.nextElement();
        if (!sid.equals(id)) {
            //PipedInputStream is=new PipedInputStream();
            //PipedOutputStream os=new PipedOutputStream(is);
            ExtendedPipedInputStream is = new ExtendedPipedInputStream();
            ExtendedPipedOutputStream os = new ExtendedPipedOutputStream(is);
            //System.err.println("Mixer: ML("+id+"): add line: "+sid);
            ml.addLine(sid, is);
            //System.err.println("Mixer: SL("+sid+"): add line: "+id);
            ((SplitterLine) splitter_lines.get(sid)).addLine(id, os);
        }
    }
    mixer_lines.put(id, ml);
    return ml;
}
Also used : Enumeration(java.util.Enumeration)

Example 57 with Enumeration

use of java.util.Enumeration in project bigbluebutton by bigbluebutton.

the class Mixer method removeOutputLine.

/** Removes a output line. */
public void removeOutputLine(Object id) {
    //System.err.println("Mixer: remove output line: "+id);
    MixerLine ml = (MixerLine) mixer_lines.get(id);
    mixer_lines.remove(id);
    /*for (Enumeration e=splitter_lines.elements(); e.hasMoreElements(); )
      {  System.err.println("Mixer: SL(?): remove line: "+id);
         ((SplitterLine)e.nextElement()).removeLine(id);
      }*/
    for (Enumeration e = splitter_lines.keys(); e.hasMoreElements(); ) {
        Object sid = e.nextElement();
        if (!sid.equals(id)) {
            //System.err.println("Mixer: ML("+id+"): remove line: "+sid);
            ml.removeLine(sid);
            //System.err.println("Mixer: SL("+sid+"): remove line: "+id);
            ((SplitterLine) splitter_lines.get(sid)).removeLine(id);
        }
    }
    try {
        ml.close();
    } catch (Exception e) {
    }
}
Also used : Enumeration(java.util.Enumeration)

Example 58 with Enumeration

use of java.util.Enumeration in project bigbluebutton by bigbluebutton.

the class MixerLine method read.

/** Reads the next byte of data from the input stream. */
public int read() throws IOException {
    int sum = 0;
    int count = 0;
    int err_code = 0;
    for (Enumeration e = input_lines.elements(); e.hasMoreElements(); ) {
        InputStream is = (InputStream) e.nextElement();
        if (is.available() > 0)
            ;
        {
            int value = is.read();
            if (value > 0) {
                count++;
                sum += G711.ulaw2linear(value);
            } else
                err_code = value;
        }
    }
    if (count > 0 || err_code == 0)
        return G711.linear2ulaw(sum);
    else
        return err_code;
}
Also used : Enumeration(java.util.Enumeration)

Example 59 with Enumeration

use of java.util.Enumeration in project spring-security by spring-projects.

the class SavedRequestAwareWrapperTests method savedRequesthHeaderIsReturnedIfSavedRequestIsSet.

@Test
@SuppressWarnings("unchecked")
public void savedRequesthHeaderIsReturnedIfSavedRequestIsSet() throws Exception {
    MockHttpServletRequest savedRequest = new MockHttpServletRequest();
    savedRequest.addHeader("header", "savedheader");
    SavedRequestAwareWrapper wrapper = createWrapper(savedRequest, new MockHttpServletRequest());
    assertThat(wrapper.getHeader("nonexistent")).isNull();
    Enumeration headers = wrapper.getHeaders("nonexistent");
    assertThat(headers.hasMoreElements()).isFalse();
    assertThat(wrapper.getHeader("Header")).isEqualTo("savedheader");
    headers = wrapper.getHeaders("heaDer");
    assertThat(headers.hasMoreElements()).isTrue();
    assertThat(headers.nextElement()).isEqualTo("savedheader");
    assertThat(headers.hasMoreElements()).isFalse();
    assertThat(wrapper.getHeaderNames().hasMoreElements()).isTrue();
    assertThat(wrapper.getHeaderNames().nextElement()).isEqualTo("header");
}
Also used : Enumeration(java.util.Enumeration) SavedRequestAwareWrapper(org.springframework.security.web.savedrequest.SavedRequestAwareWrapper) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) Test(org.junit.Test)

Example 60 with Enumeration

use of java.util.Enumeration in project Samples-for-Java by blackberry.

the class TestScreen method fieldChanged.

public void fieldChanged(Field field, int context) {
    if (simpleProvider == null) {
        try {
            simpleProvider = new SimpleLocationProvider(getMode(modeField.getSelectedIndex()));
        } catch (final Exception le) {
            UiApplication.getUiApplication().invokeLater(new Runnable() {

                public void run() {
                    Dialog.alert(le.getMessage());
                }
            });
        }
        if (simpleProvider != null) {
            simpleProvider.setGeolocationTimeout(geoTimeoutField.getSelectedValue());
            simpleProvider.setGPSTimeout(gpsTimeoutField.getSelectedValue());
            simpleProvider.setRetryFactor(retryFactorField.getSelectedValue());
            simpleProvider.setTrackignInterval(trackingIntervalField.getSelectedValue());
            simpleProvider.setMaxRetryDelay(maxRetryDelayField.getSelectedValue());
        }
    }
    if (field == startTrackingField) {
        if (simpleProvider != null) {
            simpleProvider.addSimpleLocationListener(this, trackingIntervalField.getSelectedValue());
        }
    } else if (field == stopTrackingField) {
        if (simpleProvider != null) {
            simpleProvider.removeSimpleLocationListener();
        }
    } else if (field == restartField) {
        if (simpleProvider != null) {
            try {
                simpleProvider.restart();
            } catch (IllegalStateException ise) {
                UiApplication.getUiApplication().invokeLater(new Runnable() {

                    public void run() {
                        Dialog.alert("Tracking session must be in progress. Please select Start Tracking.");
                    }
                });
            }
        }
    } else if (field == modeField) {
        if (simpleProvider != null) {
            try {
                simpleProvider.setMode(getMode(modeField.getSelectedIndex()));
            } catch (final LocationException le) {
                UiApplication.getUiApplication().invokeLater(new Runnable() {

                    public void run() {
                        Dialog.alert(le.toString());
                    }
                });
            }
        }
    } else if (field == trackingIntervalField) {
        if (simpleProvider != null) {
            simpleProvider.setTrackignInterval(trackingIntervalField.getSelectedValue());
        }
    } else if (field == gpsTimeoutField) {
        if (simpleProvider != null) {
            simpleProvider.setGPSTimeout(gpsTimeoutField.getSelectedValue());
        }
    } else if (field == geoTimeoutField) {
        if (simpleProvider != null) {
            simpleProvider.setGPSTimeout(geoTimeoutField.getSelectedValue());
        }
    } else if (field == retryFactorField) {
        if (simpleProvider != null) {
            simpleProvider.setRetryFactor(retryFactorField.getSelectedValue());
        }
    } else if (field == maxRetryDelayField) {
        if (simpleProvider != null) {
            simpleProvider.setMaxRetryDelay(maxRetryDelayField.getSelectedValue());
        }
    } else if (field == getSingleLocationField) {
        new Thread() {

            public void run() {
                location = simpleProvider.getLocation(30);
                if (location != null && location.isValid()) {
                    locationField.setText(location.getQualifiedCoordinates().getLatitude() + ", " + location.getQualifiedCoordinates().getLongitude());
                    statusField.setText("Obtained single location.");
                } else {
                    statusField.setText("Failed to obtain location!");
                }
            }
        }.start();
    } else if (field == getLastLocationField) {
        if (simpleProvider != null) {
            location = simpleProvider.getLastKnownLocation();
            if (location != null && location.isValid()) {
                locationField.setText(location.getQualifiedCoordinates().getLatitude() + ", " + location.getQualifiedCoordinates().getLongitude());
                statusField.setText("Obtained last known location.");
            } else {
                statusField.setText("Last known location not available! Please acquire a single location or start a tracking session first.");
            }
        } else {
            statusField.setText("Last known location not available! Please acquire a single location or a tracking session first.");
        }
    } else if (field == satellitesField) {
        if (location != null) {
            final PopupScreen satPopup = new PopupScreen(new VerticalFieldManager()) {

                protected boolean keyDown(int keycode, int time) {
                    int key = Keypad.key(keycode);
                    if (key == Keypad.KEY_ESCAPE) {
                        Screen screen = getScreen();
                        UiApplication.getUiApplication().popScreen(screen);
                    }
                    return true;
                }
            };
            EditField satField = new EditField("", "");
            satPopup.add(satField);
            StringBuffer buffer = new StringBuffer();
            Enumeration satEnum = location.getSatelliteInfo();
            if (satEnum != null && satEnum.hasMoreElements()) {
                buffer.append("ID\tAzimuth\tElevation\tSignal\n");
                while (satEnum.hasMoreElements()) {
                    SatelliteInfo satInfo = (SatelliteInfo) satEnum.nextElement();
                    if (satInfo != null && satInfo.isValid()) {
                        buffer.append(satInfo.getId() + "\t" + satInfo.getAzimuth() + "\t" + satInfo.getElevation() + "\t" + satInfo.getSignalQuality() + "\n");
                    }
                }
                satField.setText(buffer.toString());
            } else {
                buffer.append("No satellite information available for current location fix");
                satField.setText(buffer.toString());
            }
            UiApplication.getUiApplication().invokeLater(new Runnable() {

                public void run() {
                    UiApplication.getUiApplication().pushScreen(satPopup);
                }
            });
        } else {
            UiApplication.getUiApplication().invokeLater(new Runnable() {

                public void run() {
                    Dialog.inform("No location fix available..");
                }
            });
        }
    }
}
Also used : EditField(net.rim.device.api.ui.component.EditField) Enumeration(java.util.Enumeration) Screen(net.rim.device.api.ui.Screen) PopupScreen(net.rim.device.api.ui.container.PopupScreen) MainScreen(net.rim.device.api.ui.container.MainScreen) LocationException(javax.microedition.location.LocationException) PopupScreen(net.rim.device.api.ui.container.PopupScreen) SimpleLocationProvider(rimx.location.simplelocation.SimpleLocationProvider) LocationException(javax.microedition.location.LocationException) SatelliteInfo(net.rim.device.api.gps.SatelliteInfo) VerticalFieldManager(net.rim.device.api.ui.container.VerticalFieldManager)

Aggregations

Enumeration (java.util.Enumeration)1418 IOException (java.io.IOException)247 ArrayList (java.util.ArrayList)183 File (java.io.File)122 Vector (java.util.Vector)98 Properties (java.util.Properties)97 HashMap (java.util.HashMap)96 List (java.util.List)89 URL (java.net.URL)74 HashSet (java.util.HashSet)71 Map (java.util.Map)71 Hashtable (java.util.Hashtable)70 Iterator (java.util.Iterator)70 Set (java.util.Set)67 InputStream (java.io.InputStream)62 ZipEntry (java.util.zip.ZipEntry)62 ServletContext (javax.servlet.ServletContext)55 ZipFile (java.util.zip.ZipFile)51 FileInputStream (java.io.FileInputStream)48 ServletException (javax.servlet.ServletException)46