Giter VIP home page Giter VIP logo

tlv-processor's Introduction

# Java TLV processor

Process TLVs with the following format

  • Format: TYPE(6)-LENGTH(4)-VALUE
  • Type - fixed 6 chars length. Defines the type of processing required
  • Length - fixed 4 chars (represented as text) length of the value
  • Value - the actual data to be processed of length 'Length' above

Processing requirements

  • For Type UPPRCS: convert the value to uppercase, if already uppercase do nothing
  • For Type REPLCE: replace the value with fixed string "THIS STRING"
  • For any other type indicate an error “Type not valid” and continue processing
  • Output should be printed as the TLVs are processed
  • Input is specified on StdIn and output is expected on StdOut
  • Assume all data is in ascii
  • Assume all data will always follow the format specified, i.e. no malformed TLVs

Sample Test Cases

This is one of test case suite that will be used for evaluation. Please test your code against these before submitting. All test cases MUST pass before the code can be accepted.

The test is run as follows: java -jar tlvprocessor.jar < input Note: The input is still from STDIN.

Input:
UPPRCS-0005-abcde
REPLCE-0003-123
UPPRCS-0008-AbcdefghREPLCE-0003-123REPLCE-0001-Z
TAG001-0012-abcdefgh1234
UPPRCS-0004-1234
Output:
UPPRCS-ABCDE
REPLCE-THIS STRING
UPPRCS-ABCDEFGH
REPLCE-THIS STRING
REPLCE-THIS STRING
Type not valid
UPPRCS-1234

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.