code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private static RtcpReceiverReport buildReceiverReport(RtpStatistics statistics, boolean padding) {
RtcpReceiverReport report = new RtcpReceiverReport(padding, statistics.getSsrc());
long ssrc = statistics.getSsrc();
// Add receiver reports for each registered member
List<Long> members = statistics.getMembers... | java |
public static RtcpPacket buildReport(RtpStatistics statistics) {
// TODO Validate padding
boolean padding = false;
// Build the initial report packet
RtcpReport report;
if(statistics.hasSent()) {
report = buildSenderReport(statistics, padding);
} else {
report = buildReceiverReport(statistics, pad... | java |
public static RtcpPacket buildBye(RtpStatistics statistics) {
// TODO Validate padding
boolean padding = false;
// Build the initial report packet
RtcpReport report;
if(statistics.hasSent()) {
report = buildSenderReport(statistics, padding);
} else {
report = buildReceiverReport(statistics, paddin... | java |
public void addLocalCandidates(List<LocalCandidateWrapper> candidatesWrapper) {
for (LocalCandidateWrapper candidateWrapper : candidatesWrapper) {
addLocalCandidate(candidateWrapper, false);
}
sortCandidates();
} | java |
private void addLocalCandidate(LocalCandidateWrapper candidateWrapper, boolean sort) {
IceCandidate candidate = candidateWrapper.getCandidate();
// Configure the candidate before registration
candidate.setPriority(calculatePriority(candidate));
synchronized (this.localCandidates) {
if (!this.localCandidate... | java |
private Enumeration<NetworkInterface> getNetworkInterfaces() throws HarvestException {
try {
return NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
throw new HarvestException("Could not retrieve list of available Network Interfaces.", e);
}
} | java |
private boolean useNetworkInterface(NetworkInterface networkInterface) throws HarvestException {
try {
return !networkInterface.isLoopback() && networkInterface.isUp();
} catch (SocketException e) {
throw new HarvestException("Could not evaluate whether network interface is loopback.", e);
}
} | java |
private List<InetAddress> findAddresses() throws HarvestException {
// Stores found addresses
List<InetAddress> found = new ArrayList<InetAddress>(3);
// Retrieve list of available network interfaces
Enumeration<NetworkInterface> interfaces = getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
... | java |
private DatagramChannel openUdpChannel(InetAddress localAddress, int port, Selector selector) throws IOException {
DatagramChannel channel = DatagramChannel.open();
channel.configureBlocking(false);
// Register selector for reading operations
channel.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRI... | java |
private boolean gatherCandidate(IceComponent component, InetAddress address, int startingPort, RtpPortManager portManager, Selector selector) {
// Recursion stop criteria
if(startingPort == portManager.peek()) {
return false;
}
// Gather the candidate using current port
try {
int port = portManager.c... | java |
public byte[] process(byte[] media) {
frame++;
float[] new_speech = new float[media.length];
short[] shortMedia = Util.byteArrayToShortArray(media);
for (int i = 0; i < LD8KConstants.L_FRAME; i++) {
new_speech[i] = (float) shortMedia[i];
}
preProc.pre_process... | java |
public void exclude(String formatName) {
for (int i = 0; i < count; i++) {
md[i].exclude(formatName);
}
} | java |
public boolean contains(String encoding) {
if (encoding.equalsIgnoreCase("sendrecv") ||
encoding.equalsIgnoreCase("fmtp") ||
encoding.equalsIgnoreCase("audio") ||
encoding.equalsIgnoreCase("AS") ||
encoding.equalsIgnoreCase("IP4")) {
... | java |
private void cancelSignals() {
Iterator<String> keys = this.signals.keySet().iterator();
while (keys.hasNext()) {
cancelSignal(keys.next());
}
} | java |
public static boolean isInRangeV4(byte[] network,byte[] subnet,byte[] ipAddress)
{
if(network.length!=4 || subnet.length!=4 || ipAddress.length!=4)
return false;
return compareByteValues(network,subnet,ipAddress);
} | java |
public static boolean isInRangeV6(byte[] network,byte[] subnet,byte[] ipAddress)
{
if(network.length!=16 || subnet.length!=16 || ipAddress.length!=16)
return false;
return compareByteValues(network,subnet,ipAddress);
} | java |
private static boolean compareByteValues(byte[] network,byte[] subnet,byte[] ipAddress)
{
for(int i=0;i<network.length;i++)
if((network[i] & subnet[i]) != (ipAddress[i] & subnet[i]))
return false;
return true;
} | java |
public static IPAddressType getAddressType(String ipAddress)
{
if(IPAddressUtil.isIPv4LiteralAddress(ipAddress))
return IPAddressType.IPV4;
if(IPAddressUtil.isIPv6LiteralAddress(ipAddress))
return IPAddressType.IPV6;
return IPAddressType.INVALID;
} | java |
public void start() {
synchronized (LOCK) {
if (!this.active) {
this.active = true;
logger.info("Starting UDP Manager");
try {
generateTasks();
logger.info("Initialized UDP interface[" + inet + "]: bind address="... | java |
public void stop() {
synchronized (LOCK) {
if (this.active) {
this.active = false;
logger.info("Stopping UDP Manager");
stopTasks();
closeSelectors();
cleanResources();
logger.info("UDP Manager has stoppe... | java |
public IceMediaStream getMediaStream(String streamName) {
IceMediaStream mediaStream;
synchronized (mediaStreams) {
mediaStream = this.mediaStreams.get(streamName);
}
return mediaStream;
} | java |
public void harvest(RtpPortManager portManager) throws HarvestException, NoCandidatesGatheredException {
// Initialize the selector if necessary
if (this.selector == null || !this.selector.isOpen()) {
try {
this.selector = Selector.open();
} catch (IOException e) {
throw new HarvestException("Could no... | java |
private void fireCandidatePairSelectedEvent() {
// Stop the ICE Agent
this.stop();
// Fire the event to all listener
List<IceEventListener> listeners;
synchronized (this.iceListeners) {
listeners = new ArrayList<IceEventListener>(this.iceListeners);
}
SelectedCandidatesEvent event = new SelectedCandi... | java |
public void getPayload(byte[] buff, int offset) {
buffer.position(FIXED_HEADER_SIZE);
buffer.get(buff, offset, buffer.limit() - FIXED_HEADER_SIZE);
} | java |
public void wrap(boolean mark, int payloadType, int seqNumber, long timestamp, long ssrc, byte[] data, int offset, int len) {
buffer.clear();
buffer.rewind();
//no extensions, paddings and cc
buffer.put((byte)0x80);
byte b = (byte) (payloadType);
if (mark) {
... | java |
public int getExtensionLength()
{
if (!getExtensionBit())
return 0;
//the extension length comes after the RTP header, the CSRC list, and
//after two bytes in the extension header called "defined by profile"
int extLenIndex = FIXED_HEADER_SIZE
+ ... | java |
public void grow(int delta) {
if (delta == 0) {
return;
}
int newLen = buffer.limit()+delta;
if (newLen <= buffer.capacity()) {
// there is more room in the underlying reserved buffer memory
buffer.limit(newLen);
return;
} else {
... | java |
public MgcpEndpoint registerEndpoint(String namespace) throws UnrecognizedMgcpNamespaceException {
// Get correct endpoint provider
MgcpEndpointProvider<?> provider = this.providers.get(namespace);
if (provider == null) {
throw new UnrecognizedMgcpNamespaceException("Namespace " + na... | java |
public void unregisterEndpoint(String endpointId) throws MgcpEndpointNotFoundException {
MgcpEndpoint endpoint = this.endpoints.remove(endpointId);
if (endpoint == null) {
throw new MgcpEndpointNotFoundException("Endpoint " + endpointId + " not found");
}
endpoint.forget((Mgc... | java |
public void offer(Event event) {
sequence += event.toString();
//check pattern matching
if (patterns != null && sequence.length() > 0) {
for (int i = 0; i < patterns.length; i++) {
if (sequence.matches(patterns[i])) {
listener.patternMatch... | java |
private int getMax(double data[]) {
int idx = 0;
double max = data[0];
for (int i = 1; i < data.length; i++) {
if (max < data[i]) {
max = data[i];
idx = i;
}
}
return idx;
} | java |
private String getTone(double f[], double F[]) {
int fm = getMax(f);
boolean fd = true;
for (int i = 0; i < f.length; i++) {
if (fm == i) {
continue;
}
double r = f[fm] / (f[i] + 1E-15);
if (r < threshold) {
fd = fa... | java |
@Override
public void setMessageType(char indicationType)
throws IllegalArgumentException {
/*
* old TURN DATA indication type is an indication despite 0x0115 &
* 0x0110 indicates STUN error response type
*/
if (!isIndicationType(indicationType)
&& indicationType != StunMessage.OLD_DATA_INDICATION)... | java |
public void run() {
if (this.isActive) {
try {
perform();
//notify listener
if (this.listener != null) {
this.listener.onTerminate();
}
} catch (Exception e) {
logger.error("Could not execu... | java |
public byte[] encode() {
char type = getAttributeType();
byte binValue[] = new byte[HEADER_LENGTH + getDataLength()];
// Type
binValue[0] = (byte) (type >> 8);
binValue[1] = (byte) (type & 0x00FF);
// Length
binValue[2] = (byte) (getDataLength() >> 8);
binValue[3] = (byte) (getDataLength() & 0x00FF);
... | java |
public void push(String symbol) {
long now = System.currentTimeMillis();
if (!symbol.equals(lastSymbol) || (now - lastActivity > interdigitInterval)) {
lastActivity = now;
lastSymbol = symbol;
detectorImpl.fireEvent(symbol);
}
else
... | java |
protected void queue(DtmfEventImpl evt) {
if (queue.size() == size) {
queue.poll();
}
queue.offer(evt);
logger.info(String.format("(%s) Buffer size: %d", detectorImpl.getName(), queue.size()));
} | java |
public void flush() {
logger.info(String.format("(%s) Flush, buffer size: %d", detectorImpl.getName(), queue.size()));
while(queue.size()>0)
detectorImpl.fireEvent(queue.poll());
} | java |
public Date getCreationTime() {
calendar.set(Calendar.YEAR, 1904);
calendar.set(Calendar.MONTH, Calendar.JANUARY);
calendar.set(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.roll(Calendar.SECOND, (int) creationTime);... | java |
public String generateFingerprint(String hashFunction) {
try {
this.hashFunction = hashFunction;
org.bouncycastle.crypto.tls.Certificate chain = TlsUtils.loadCertificateChain(certificateResources);
Certificate certificate = chain.getCertificateAt(0);
return TlsUtils.fingerprint(this.hashFunction, certific... | java |
public void getCipherStream(BlockCipher aesCipher, byte[] out, int length, byte[] iv) {
System.arraycopy(iv, 0, cipherInBlock, 0, 14);
int ctr;
for (ctr = 0; ctr < length / BLKLEN; ctr++) {
// compute the cipher stream
cipherInBlock[14] = (byte) ((ctr & 0xFF00) >> ... | java |
private void processComponents(MAPDialogImpl mapDialogImpl, Component[] components) {
// Now let us decode the Components
for (Component c : components) {
doProcessComponent(mapDialogImpl, c);
}
} | java |
private void fireTCAbortACNNotSupported(Dialog tcapDialog, MAPExtensionContainer mapExtensionContainer,
ApplicationContextName alternativeApplicationContext, boolean returnMessageOnError) throws MAPException {
if (this.getTCAPProvider().getPreviewMode()) {
return;
}
if ... | java |
protected void fireTCAbortUser(Dialog tcapDialog, MAPUserAbortChoice mapUserAbortChoice,
MAPExtensionContainer mapExtensionContainer, boolean returnMessageOnError) throws MAPException {
if (this.getTCAPProvider().getPreviewMode()) {
return;
}
if (tcapDialog.getApplicati... | java |
protected void fireTCAbortProvider(Dialog tcapDialog, MAPProviderAbortReason mapProviderAbortReason,
MAPExtensionContainer mapExtensionContainer, boolean returnMessageOnError) throws MAPException {
if (this.getTCAPProvider().getPreviewMode()) {
return;
}
if (tcapDialog.... | java |
protected void fireTCAbortV1(Dialog tcapDialog, boolean returnMessageOnError) throws MAPException {
if (this.getTCAPProvider().getPreviewMode()) {
return;
}
TCUserAbortRequest tcUserAbort = this.getTCAPProvider().getDialogPrimitiveFactory().createUAbort(tcapDialog);
if (ret... | java |
protected void startInitialAlignment(boolean resetTxOffset) {
if (logger.isDebugEnabled()) {
logger.debug(String.format("(%s) Starting initial alignment", name));
}
// Comment from Oleg: this is done initialy to setup correct spot in tx
// buffer: dunno, I just believe, for ... | java |
private void processRx(byte[] buff, int len) {
int i = 0;
// start HDLC alg
while (i < len) {
while (rxState.bits <= 24 && i < len) {
int b = buff[i++] & 0xff;
hdlc.fasthdlc_rx_load_nocheck(rxState, b);
if (rxState.state == 0) {
... | java |
private void countFrame() {
if (state == MTP2_ALIGNED_READY || state == MTP2_INSERVICE) {
dCount = (dCount + 1) % 256;
// decrement error countor for each 256 frames
if (dCount == 0 && eCount > 0) {
eCount--;
}
}
} | java |
public static void main(String[] args) throws Throwable {
String homeDir = getHomeDir(args);
System.setProperty(TRACE_PARSER_HOME, homeDir);
String dataDir = homeDir + File.separator + "data" + File.separator;
System.setProperty(TRACE_PARSER_DATA, dataDir);
if (!initLOG4JPropert... | java |
protected void encode(ByteBuffer txBuffer) {
txBuffer.position(4); // Length int
txBuffer.put(data);
int length = txBuffer.position();
txBuffer.rewind();
txBuffer.putInt(length);
txBuffer.position(length);
} | java |
public void initializeMessageNumbering(SccpConnDt2MessageImpl msg) {
sendSequenceNumber = getNextSequenceNumber();
msg.setSequencing(sendSequenceNumber, sendSequenceNumberExpectedAtInput);
inputWindow.setLowerEdge(sendSequenceNumberExpectedAtInput);
} | java |
public boolean checkInputMessageNumbering(SccpConnectionImpl conn, SequenceNumber sendSequenceNumber,
SequenceNumber receiveSequenceNumber) throws Exception {
if (sendSequenceNumber != null) {
if (expectingFirstMessageInputAfterInit && !sendSequenceNumbe... | java |
public void reinitialize() {
inputWindow = new SccpFlowControlWindow(new SequenceNumberImpl(0), maximumWindowSize);
outputWindow = new SccpFlowControlWindow(new SequenceNumberImpl(0), maximumWindowSize);
sendSequenceNumberExpectedAtInput = new SequenceNumberImpl(0);
// inputWindow.setLo... | java |
private void rebind(Object stack) throws NamingException {
if (jndiName != null) {
Context ctx = new InitialContext();
String[] tokens = jndiName.split("/");
for (int i = 0; i < tokens.length - 1; i++) {
if (tokens[i].trim().length() > 0) {
... | java |
private void unbind(String jndiName) throws NamingException {
InitialContext initialContext = new InitialContext();
initialContext.unbind(jndiName);
} | java |
public void handleHeartbeat(Heartbeat hrtBeat) {
HeartbeatAck hrtBeatAck = (HeartbeatAck) this.aspFactoryImpl.messageFactory.createMessage(
MessageClass.ASP_STATE_MAINTENANCE, MessageType.HEARTBEAT_ACK);
hrtBeatAck.setHeartbeatData(hrtBeat.getHeartbeatData());
this.aspFactoryImpl... | java |
protected void reset() {
for (RouteMap.Entry<String, RouteAsImpl> e = this.route.head(), end = this.route.tail(); (e = e.getNext()) != end;) {
String key = e.getKey();
RouteAsImpl routeAs = e.getValue();
routeAs.setM3uaManagement(this.m3uaManagement);
routeAs.rese... | java |
public Message createMessage(ByteBuffer buffer) {
if (!isHeaderReady) {
int len = Math.min(MESSAGE_HEADER_SIZE - pos, buffer.remaining());
buffer.get(header, pos, len);
// update cursor postion in the header's buffer
pos += len;
// header completed?... | java |
protected void encodeMandatoryVariableParameters(Map<Integer, ISUPParameter> parameters, ByteArrayOutputStream bos,
boolean isOptionalPartPresent) throws ParameterException {
try {
byte[] pointers = null;
// complicated
if (!mandatoryVariablePartPossible()) {
... | java |
protected int decodeMandatoryParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
throws ParameterException {
int localIndex = index;
if (b.length - index >= 3) {
try {
byte[] cic = new byte[2];
cic[0] = b[index++];
... | java |
protected int decodeMandatoryVariableParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
throws ParameterException {
// FIXME: possibly this should also be per msg, since if msg lacks
// proper parameter, decoding wotn pick this up and will throw
// some bad output... | java |
private boolean addIncomingInvokeId(Long invokeId) {
synchronized (this.incomingInvokeList) {
if (this.incomingInvokeList.contains(invokeId))
return false;
else {
this.incomingInvokeList.add(invokeId);
return true;
}
}
... | java |
public void resetTimer(Long invokeId) throws TCAPException {
try {
this.dialogLock.lock();
int index = getIndexFromInvokeId(invokeId);
InvokeImpl invoke = operationsSent[index];
if (invoke == null) {
throw new TCAPException("No operation with this ... | java |
public static String hexDump(String label, byte[] bytes) {
final int modulo = 16;
final int brk = modulo / 2;
int indent = (label == null) ? 0 : label.length();
StringBuffer sb = new StringBuffer(indent + 1);
while (indent > 0) {
sb.append(" ");
indent--... | java |
public void setMaxSequenceNumber(int maxSequenceNumber) throws Exception {
if (this.isStarted)
throw new Exception("MaxSequenceNumber parameter can be updated only when M3UA stack is NOT running");
if (maxSequenceNumber < 1) {
maxSequenceNumber = 1;
} else if (maxSequenc... | java |
public void startAsp(String aspName) throws Exception {
AspFactoryImpl aspFactoryImpl = this.getAspFactory(aspName);
if (aspFactoryImpl == null) {
throw new Exception(String.format(M3UAOAMMessages.NO_ASP_FOUND, aspName));
}
if (aspFactoryImpl.getStatus()) {
thro... | java |
public void add(Mtp2 link) {
// add link at the first empty place
for (int i = 0; i < links.length; i++) {
if (links[i] == null) {
links[i] = link;
break;
}
}
count++;
remap();
} | java |
private void remap() {
int k = -1;
for (int i = 0; i < map.length; i++) {
boolean found = false;
for (int j = k + 1; j < links.length; j++) {
if (links[j] != null) {
found = true;
k = j;
map[i] = k;
... | java |
protected Dialog createNewTCAPDialog(SccpAddress origAddress, SccpAddress destAddress, Long localTrId) throws MAPException {
try {
return this.mapProviderImpl.getTCAPProvider().getNewDialog(origAddress, destAddress, localTrId);
} catch (TCAPException e) {
throw new MAPException(e... | java |
private synchronized Long getAvailableTxId() throws TCAPException {
if (this.dialogs.size() >= this.stack.getMaxDialogs())
throw new TCAPException("Current dialog count exceeds its maximum value");
while (true) {
// Long id;
// if (!currentDialogId.compareAndSet(this.s... | java |
protected int getNextSeqControl() {
int res = seqControl.getAndIncrement();
// if (!seqControl.compareAndSet(256, 1)) {
// return seqControl.getAndIncrement();
// } else {
// return 0;
// }
// seqControl++;
// if (seqControl > 255) {
// seqContro... | java |
protected Dialog createNewTCAPDialog(SccpAddress origAddress, SccpAddress destAddress, Long localTrId) throws CAPException {
try {
return this.capProviderImpl.getTCAPProvider().getNewDialog(origAddress, destAddress, localTrId);
} catch (TCAPException e) {
throw new CAPException(e... | java |
public int encodeDigits(ByteArrayOutputStream bos) {
boolean isOdd = this.oddFlag == _FLAG_ODD;
byte b = 0;
int count = (!isOdd) ? address.length() : address.length() - 1;
int bytesCount = 0;
for (int i = 0; i < count - 1; i += 2) {
String ds1 = address.substring(i, ... | java |
public ShellChannel accept() throws IOException {
SocketChannel newChannel = ((ServerSocketChannel) channel).accept();
if (newChannel == null)
return null;
return new ShellChannelExt(chanProvider, newChannel);
} | java |
private void parseSmsSignalInfo(SmsSignalInfo si, boolean isMo, boolean isMt) {
if (si == null)
return;
if (isMo) {
try {
SmsTpdu tpdu = si.decodeTpdu(true);
parseSmsTpdu(tpdu);
} catch (MAPException e) {
// TODO Auto-... | java |
protected AspImpl getAspForNullRc() {
// We know if null RC, ASP cannot be shared and AspFactory will
// have only one ASP
AspImpl aspImpl = (AspImpl) this.aspFactoryImpl.aspList.get(0);
if (this.aspFactoryImpl.aspList.size() > 1) {
// verify that AS to which this ASP is ad... | java |
protected void sendTransferMessageToLocalUser(Mtp3TransferPrimitive msg, int seqControl) {
if (this.isStarted) {
MsgTransferDeliveryHandler hdl = new MsgTransferDeliveryHandler(msg);
seqControl = seqControl & slsFilter;
this.msgDeliveryExecutors[this.slsTable[seqControl]].ex... | java |
protected static String getHomeDir(String[] args) {
if (System.getenv(HOME_DIR) == null) {
if (args.length > index) {
return args[index++];
} else {
return ".";
}
} else {
return System.getenv(HOME_DIR);
}
} | java |
private void linkUp(Mtp2 link) {
if (link.mtp2Listener != null) {
link.mtp2Listener.linkUp();
}
linkset.add(link);
if (linkset.isActive() && this.mtp3Listener != null) {
try {
mtp3Listener.linkUp();
} catch (Exception e) {
... | java |
private boolean checkPattern(Mtp2Buffer frame, int sltmLen, byte[] pattern) {
if (sltmLen != pattern.length) {
return false;
}
for (int i = 0; i < pattern.length; i++) {
if (frame.frame[i + PATTERN_OFFSET] != pattern[i]) {
return false;
}
... | java |
public static String bcdToHexString(int encodingScheme, byte bcdByte) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
byte leftNibble = (byte) (bcdByte & 0xf0);
leftNibble = (byte) (leftNibble >>> 4);
leftNibble = (byte) (leftNibble & 0x0f);
byte rig... | java |
public static String bcdDecodeToHexString(int encodingScheme, byte[] bcdBytes) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
for (byte b : bcdBytes) {
sb.append(bcdToHexString(encodingScheme, b));
}
if (GenericDigits._ENCODING_SCHEME_BCD_ODD =... | java |
private PowerShell initalize(String powerShellExecutablePath) throws PowerShellNotAvailableException {
String codePage = PowerShellCodepage.getIdentifierByCodePageName(Charset.defaultCharset().name());
ProcessBuilder pb;
//Start powershell executable in process
if (OSDetector.isWindows(... | java |
public static PowerShellResponse executeSingleCommand(String command) {
PowerShellResponse response = null;
try (PowerShell session = PowerShell.openSession()) {
response = session.executeCommand(command);
} catch (PowerShellNotAvailableException ex) {
logger.log(Level.S... | java |
private void handleResponse(PowerShellResponseHandler response, PowerShellResponse powerShellResponse) {
try {
response.handle(powerShellResponse);
} catch (Exception ex) {
logger.log(Level.SEVERE, "PowerShell not available", ex);
}
} | java |
@SuppressWarnings("WeakerAccess")
public PowerShellResponse executeScript(String scriptPath, String params) {
BufferedReader srcReader;
try {
srcReader = new BufferedReader(new FileReader(new File(scriptPath)));
} catch (FileNotFoundException fnfex) {
logger.log(Leve... | java |
public PowerShellResponse executeScript(BufferedReader srcReader, String params) {
PowerShellResponse response;
if (srcReader != null) {
File tmpFile = createWriteTempFile(srcReader);
if (tmpFile != null) {
this.scriptMode = true;
response = execut... | java |
private File createWriteTempFile(BufferedReader srcReader) {
BufferedWriter tmpWriter = null;
File tmpFile = null;
try {
tmpFile = File.createTempFile("psscript_" + new Date().getTime(), ".ps1", this.tempFolder);
if (!tmpFile.exists()) {
return null;
... | java |
@Override
public void close() {
if (!this.closed) {
try {
Future<String> closeTask = threadpool.submit(() -> {
commandWriter.println("exit");
p.waitFor();
return "OK";
});
if (!closeAndWai... | java |
private File getTempFolder(String tempPath) {
if (tempPath != null) {
File folder = new File(tempPath);
if (folder.exists()) {
return folder;
}
}
return null;
} | java |
public static String getIdentifierByCodePageName(String cpName) {
if (cpName != null) {
for (Entry<String, String> codePage : codePages.entrySet()) {
if (codePage.getValue().toLowerCase().equals(cpName.toLowerCase())) {
return codePage.getKey();
}
... | java |
public String call() throws InterruptedException {
StringBuilder powerShellOutput = new StringBuilder();
try {
if (startReading()) {
readData(powerShellOutput);
}
} catch (IOException ioe) {
Logger.getLogger(PowerShell.class.getName()).log(Lev... | java |
private void readData(StringBuilder powerShellOutput) throws IOException {
String line;
while (null != (line = this.reader.readLine())) {
//In the case of script mode it finish when the last line is read
if (this.scriptMode) {
if (line.equals(PowerShell.END_SCRIP... | java |
private boolean startReading() throws IOException, InterruptedException {
//If the reader is not ready, gives it some milliseconds
while (!this.reader.ready()) {
Thread.sleep(this.waitPause);
if (this.closed) {
return false;
}
}
return ... | java |
private boolean canContinueReading() throws IOException, InterruptedException {
//If the reader is not ready, gives it some milliseconds
//It is important to do that, because the ready method guarantees that the readline will not be blocking
if (!this.reader.ready()) {
Thread.sleep(t... | java |
public static FilterBuilder any(final Predicate... alternatives) {
return new CommonFilterBuilder() {
@Override
public boolean matches(Class<?> klass) {
for (Predicate alternative : alternatives) {
if (alternative.matches(klass)) {
return true;
}
}
return false;
}
};
} | java |
protected final void indexAnnotations(Class<?>... classes) {
for (Class<?> klass : classes) {
indexedAnnotations.add(klass.getCanonicalName());
}
annotationDriven = false;
} | java |
protected final void indexSubclasses(Class<?>... classes) {
for (Class<?> klass : classes) {
indexedSuperclasses.add(klass.getCanonicalName());
}
annotationDriven = false;
} | java |
public final boolean isRouteExternal(RouteHeader routeHeader) {
if (routeHeader != null) {
javax.sip.address.SipURI routeUri = (javax.sip.address.SipURI) routeHeader.getAddress().getURI();
String routeTransport = routeUri.getTransportParam();
if(routeTransport == null) {
routeTransport = ListeningPoint.... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.