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;
}
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) {
}
}
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;
}
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");
}
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..");
}
});
}
}
}
Aggregations