Decode the 'action' for a supplied an Invoke.

@param encoding
AMF encoding
@param in
buffer
@param header
data header
@return notify
427304
private Invoke decodeAction(Encoding encoding, IoBuffer in, Header header) {
        // for response, the action string and invokeId is always encoded as AMF0 we use the first byte to decide which encoding to use
        in.mark();
        byte tmp = in.get();
        in.reset();
        Input input;
        if (encoding == Encoding.AMF3 && tmp == AMF.TYPE_AMF3_OBJECT) {
            input = new org.red5.io.amf3.Input(in);
            ((org.red5.io.amf3.Input) input).enforceAMF3();
        } else {
            input = new org.red5.io.amf.Input(in);
        }
        // get the action
        String action = Deserializer.deserialize(input, String.class);
        if (action == null) {
            throw new RuntimeException("Action was null");
        }
        if (log.isTraceEnabled()) {
            log.trace("Action: {}", action);
        }
        // instance the invoke
        Invoke invoke = new Invoke();
        // set the transaction id
        invoke.setTransactionId(readTransactionId(input));
        // reset and decode parameters
        input.reset();
        // get / set the parameters if there any
        Object[] params = in.hasRemaining() ? handleParameters(in, invoke, input) : new Object[0];
        // determine service information
        final int dotIndex = action.lastIndexOf('.');
        String serviceName = (dotIndex == -1) ? null : action.substring(0, dotIndex);
        // pull off the prefixes since java doesn't allow this on a method name
        if (serviceName != null && (serviceName.startsWith("@") || serviceName.startsWith("|"))) {
            serviceName = serviceName.substring(1);
        }
        String serviceMethod = (dotIndex == -1) ? action : action.substring(dotIndex + 1, action.length());
        // pull off the prefixes since java doesnt allow this on a method name
        if (serviceMethod.startsWith("@") || serviceMethod.startsWith("|")) {
            serviceMethod = serviceMethod.substring(1);
        }
        // create the pending call for invoke
        PendingCall call = new PendingCall(serviceName, serviceMethod, params);
        invoke.setCall(call);
        return invoke;
    }
1251305
public LogEvent decode(LogBuffer buffer, LogContext context) throws IOException {
        final int limit = buffer.limit();

        if (limit >= FormatDescriptionLogEvent.LOG_EVENT_HEADER_LEN) {
            LogHeader header = new LogHeader(buffer, context.getFormatDescription());

            final int len = header.getEventLen();
            if (limit >= len) {
                LogEvent event;

                /* Checking binary-log's header */
                if (handleSet.get(header.getType())) {
                    buffer.limit(len);
                    try {
                        /* Decoding binary-log to event */
                        event = decode(buffer, header, context);
                    } catch (IOException e) {
                        if (logger.isWarnEnabled()) {
                            logger.warn("Decoding " + LogEvent.getTypeName(header.getType()) + " failed from: "
                                        + context.getLogPosition(), e);
                        }
                        throw e;
                    } finally {
                        buffer.limit(limit); /* Restore limit */
                    }
                } else {
                    /* Ignore unsupported binary-log. */
                    event = new UnknownLogEvent(header);
                }

                if (event != null) {
                    // set logFileName
                    event.getHeader().setLogFileName(context.getLogPosition().getFileName());
                    event.setSemival(buffer.semival);
                }

                /* consume this binary-log. */
                buffer.consume(len);
                return event;
            }
        }

        /* Rewind buffer's position to 0. */
        buffer.rewind();
        return null;
    }
193858
@Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
            throws Exception {
        in.markReaderIndex();
        int preIndex = in.readerIndex();
        int length = readRawVarint32(in);
        if (preIndex == in.readerIndex()) {
            return;
        }
        if (length < 0) {
            throw new CorruptedFrameException("negative length: " + length);
        }

        if (in.readableBytes() < length) {
            in.resetReaderIndex();
        } else {
            out.add(in.readRetainedSlice(length));
        }
    }
203653
public static String encode(byte[] in) {
        if (in == null) {
            return null;
        }
        return encode(in, 0, in.length);
    }
1214344
public void setResponseCharacterEncoding(String encoding)
    {
        ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
        
        if (ctx == null)
        {
            throw new UnsupportedOperationException();
        }
        
        ctx.setResponseCharacterEncoding(encoding);
    }
241522
public void setEncoding(String encoding) {

        checkFrozen();
        m_encoding = CmsEncoder.lookupEncoding(encoding, OpenCms.getSystemInfo().getDefaultEncoding());
    }
281304
private DecoderState decodeEnvelope(ByteBuf in) throws IOException {
		// 
		// (1) header (EnvelopeEncoder.HEADER_SIZE bytes)
		// 
		if (this.currentEnvelope == null) {
			copy(in, this.headerBuffer);

			if (this.headerBuffer.hasRemaining()) {
				return DecoderState.PENDING;
			}
			else {
				this.headerBuffer.flip();

				int magicNum = this.headerBuffer.getInt();
				if (magicNum != OutboundEnvelopeEncoder.MAGIC_NUMBER) {
					throw new IOException("Network stream corrupted: invalid magic" +
							"number in current envelope header.");
				}

				int seqNum = this.headerBuffer.getInt();
				JobID jobId = JobID.fromByteBuffer(this.headerBuffer);
				ChannelID sourceId = ChannelID.fromByteBuffer(this.headerBuffer);

				this.currentEnvelope = new Envelope(seqNum, jobId, sourceId);

				int eventsSize = this.headerBuffer.getInt();
				int bufferSize = this.headerBuffer.getInt();

				this.currentEventsBuffer = eventsSize > 0 ? ByteBuffer.allocate(eventsSize) : null;
				this.currentBufferRequestSize = bufferSize > 0 ? bufferSize : 0;

				this.headerBuffer.clear();
			}
		}

		// 
		// (2) events (var length)
		// 
		if (this.currentEventsBuffer != null) {
			copy(in, this.currentEventsBuffer);

			if (this.currentEventsBuffer.hasRemaining()) {
				return DecoderState.PENDING;
			}
			else {
				this.currentEventsBuffer.flip();
				this.currentEnvelope.setEventsSerialized(this.currentEventsBuffer);
				this.currentEventsBuffer = null;
			}
		}

		// 
		// (3) buffer (var length)
		// 
		// (a) request a buffer from OUR pool
		if (this.currentBufferRequestSize > 0) {
			JobID jobId = this.currentEnvelope.getJobID();
			ChannelID sourceId = this.currentEnvelope.getSource();
			Buffer buffer = requestBufferForTarget(jobId, sourceId, this.currentBufferRequestSize);

			if (buffer == null) {
				return DecoderState.NO_BUFFER_AVAILABLE;
			}
			else {
				this.currentEnvelope.setBuffer(buffer);
				this.currentDataBuffer = buffer.getMemorySegment().wrap(0, this.currentBufferRequestSize);
				this.currentBufferRequestSize = 0;
			}
		}

		// (b) copy data to OUR buffer
		if (this.currentDataBuffer != null) {
			copy(in, this.currentDataBuffer);

			if (this.currentDataBuffer.hasRemaining()) {
				return DecoderState.PENDING;
			}
			else {
				this.currentDataBuffer = null;
			}
		}

		// if we made it to this point, we completed the envelope;
		// in the other cases we return early with PENDING or NO_BUFFER_AVAILABLE
		return DecoderState.COMPLETE;
	}
550945
public boolean startDecode() throws IOException {
        if(insideSOS) {
            throw new IllegalStateException("decode already started");
        }
        if(foundEOI) {
            return false;
        }

        decodeHeader();
        int m = getMarker();
        while(m != 0xD9) {  // EOI
            if(m == 0xDA) { // SOS
                processScanHeader();
                insideSOS = true;
                currentMCURow = 0;
                reset();
                return true;
            } else {
                processMarker(m);
            }
            m = getMarker();
        }

        foundEOI = true;
        return false;
    }
246423
protected IoBuffer encodeCommand(Notify invoke) {
        IoBuffer out = IoBuffer.allocate(1024);
        out.setAutoExpand(true);
        encodeCommand(out, invoke);
        return out;
    }
1030342
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        if ( len < 24 ) {
            throw new SMBProtocolDecodingException("Invalid resume key");
        }

        this.resumeKey = new byte[24];
        System.arraycopy(buffer, bufferIndex, this.resumeKey, 0, 24);
        bufferIndex += 24;

        SMBUtil.readInt4(buffer, bufferIndex); // contextLength - reserved
        bufferIndex += 4;

        return bufferIndex - start;
    }
395830
public static int decodeSingle(final byte[] input, final int inoff) {

        if (input == null) {
            throw new NullPointerException("input");
        }

        if (input.length < 2) {
            // not required by (inoff >= input.length -1) checked below
            throw new IllegalArgumentException(
                "input.length(" + input.length + ") < 2");
        }

        if (inoff < 0) {
            throw new IllegalArgumentException("inoff(" + inoff + ") < 0");
        }

        if (inoff >= input.length - 1) {
            throw new IllegalArgumentException(
                "inoff(" + inoff + ") >= input.length(" + input.length
                + ") - 1");
        }

        return (decodeHalf(input[inoff] & 0xFF) << 4)
               | decodeHalf(input[inoff + 1] & 0xFF);
    }
416960
@Override
  protected void channelRead0(final ChannelHandlerContext ctx, final HttpObject msg) throws Exception {
    if (msg instanceof HttpContent) {
      HttpContent content = (HttpContent) msg;
      decodeChunk((InetSocketAddress) ctx.channel().remoteAddress(), content.content());
    }
  }
21437
public IoBuffer encodeHeader(Header header, Header lastHeader) {
        final IoBuffer result = IoBuffer.allocate(calculateHeaderSize(header, lastHeader));
        encodeHeader(header, lastHeader, result);
        return result;
    }
686148
@Override
    protected final void encode(final ChannelHandlerContext ctx, final JNRPEResponse msg, final ByteBuf out) {
        out.writeBytes(msg.toByteArray());
    }
922409
public final byte[] decode(String in) {

        // sanitize the parameters
        if (in == null) {
            throw new NullPointerException();
        }

        // create the result buffer
        byte[] out = new byte[in.length() * bits / 8];

        // decode
        int outCount = 0; // number of output bytes produced
        int inCount = 0; // number of input characters consumed
        int buf = 0; // buffer of input bits not yet sent to output
        int bufBits = 0; // number of bits in the bit buffer
        while (inCount < in.length()) {
            int next = in.codePointAt(inCount);
            inCount++;
            if (next < min || next > max) {
                continue;
            }
            next = values[next - min];
            if (next == -1) {
                continue;
            }
            buf = (buf << bits) | next;
            bufBits += bits;
            while (bufBits >= 8) {
                out[outCount] = (byte) ((buf >>> (bufBits - 8)) & 0xff);
                bufBits -= 8;
                outCount++;
            }
        }

        // trim the result if there were any skipped characters
        if (outCount < out.length) {
            byte[] tmp = out;
            out = new byte[outCount];
            System.arraycopy(tmp, 0, out, 0, outCount);
        }
        return out;
    }
5851
public static byte[] decodeToBytes(CharSequence in) throws IOException{
		if(in == null) return null;
		ByteArrayOutputStream baos = new ByteArrayOutputStream(in.length());
		decode(in, baos);
		return baos.toByteArray();
	}
1034322
public FieldElement decode(byte[] in) {
    long h0 = load_4(in, 0);
    long h1 = load_3(in, 4) << 6;
    long h2 = load_3(in, 7) << 5;
    long h3 = load_3(in, 10) << 3;
    long h4 = load_3(in, 13) << 2;
    long h5 = load_4(in, 16);
    long h6 = load_3(in, 20) << 7;
    long h7 = load_3(in, 23) << 5;
    long h8 = load_3(in, 26) << 4;
    long h9 = (load_3(in, 29) & 0x7FFFFF) << 2;
    long carry0;
    long carry1;
    long carry2;
    long carry3;
    long carry4;
    long carry5;
    long carry6;
    long carry7;
    long carry8;
    long carry9;

    // Remember: 2^255 congruent 19 modulo p
    carry9 = (h9 + (long) (1 << 24)) >> 25;
    h0 += carry9 * 19;
    h9 -= carry9 << 25;
    carry1 = (h1 + (long) (1 << 24)) >> 25;
    h2 += carry1;
    h1 -= carry1 << 25;
    carry3 = (h3 + (long) (1 << 24)) >> 25;
    h4 += carry3;
    h3 -= carry3 << 25;
    carry5 = (h5 + (long) (1 << 24)) >> 25;
    h6 += carry5;
    h5 -= carry5 << 25;
    carry7 = (h7 + (long) (1 << 24)) >> 25;
    h8 += carry7;
    h7 -= carry7 << 25;

    carry0 = (h0 + (long) (1 << 25)) >> 26;
    h1 += carry0;
    h0 -= carry0 << 26;
    carry2 = (h2 + (long) (1 << 25)) >> 26;
    h3 += carry2;
    h2 -= carry2 << 26;
    carry4 = (h4 + (long) (1 << 25)) >> 26;
    h5 += carry4;
    h4 -= carry4 << 26;
    carry6 = (h6 + (long) (1 << 25)) >> 26;
    h7 += carry6;
    h6 -= carry6 << 26;
    carry8 = (h8 + (long) (1 << 25)) >> 26;
    h9 += carry8;
    h8 -= carry8 << 26;

    int[] h = new int[10];
    h[0] = (int) h0;
    h[1] = (int) h1;
    h[2] = (int) h2;
    h[3] = (int) h3;
    h[4] = (int) h4;
    h[5] = (int) h5;
    h[6] = (int) h6;
    h[7] = (int) h7;
    h[8] = (int) h8;
    h[9] = (int) h9;
    return new Ed25519FieldElement(f, h);
  }