Tabnine Logo
TypeValue.setType
Code IndexAdd Tabnine to your IDE (free)

How to use
setType
method
in
uk.gov.gchq.gaffer.types.TypeValue

Best Java code snippets using uk.gov.gchq.gaffer.types.TypeValue.setType (Showing top 3 results out of 315)

origin: gchq/Gaffer

@Override
public TypeValue deserialise(final byte[] bytes) throws SerialisationException {
  int lastDelimiter = 0;
  TypeValue typeValue = new TypeValue();
  for (int i = 0; i < bytes.length; i++) {
    if (bytes[i] == ByteArrayEscapeUtils.DELIMITER) {
      if (i > 0) {
        try {
          typeValue.setType(new String(ByteArrayEscapeUtils.unEscape(bytes, lastDelimiter, i), CommonConstants.UTF_8));
        } catch (final UnsupportedEncodingException e) {
          throw new SerialisationException("Failed to deserialise the Type from TypeValue Object", e);
        }
      }
      lastDelimiter = i + 1;
      break;
    }
  }
  if (bytes.length > lastDelimiter) {
    try {
      typeValue.setValue(new String(ByteArrayEscapeUtils.unEscape(bytes, lastDelimiter, bytes.length), CommonConstants.UTF_8));
    } catch (final UnsupportedEncodingException e) {
      throw new SerialisationException("Failed to deserialise the Value from TypeValue Object", e);
    }
  }
  return typeValue;
}
origin: gchq/Gaffer

@Test
public void testCanSerialiseDeSerialiseCorrectlyTypeOnly() throws SerialisationException {
  TypeValue typeValue = new TypeValue();
  typeValue.setType("testType");
  byte[] bytes = serialiser.serialise(typeValue);
  String serialisedForm = new String(bytes);
  assertEquals("testType\0", serialisedForm);
  TypeValue deSerialisedTypeValue = serialiser.deserialise(bytes);
  assertEquals(typeValue.getType(), deSerialisedTypeValue.getType());
  assertNull(typeValue.getValue(), deSerialisedTypeValue.getValue());
  assertEquals(typeValue, deSerialisedTypeValue);
}
origin: uk.gov.gchq.gaffer/type

@Override
public TypeValue deserialise(final byte[] bytes) throws SerialisationException {
  int lastDelimiter = 0;
  TypeValue typeValue = new TypeValue();
  for (int i = 0; i < bytes.length; i++) {
    if (bytes[i] == ByteArrayEscapeUtils.DELIMITER) {
      if (i > 0) {
        try {
          typeValue.setType(new String(ByteArrayEscapeUtils.unEscape(bytes, lastDelimiter, i), CommonConstants.UTF_8));
        } catch (final UnsupportedEncodingException e) {
          throw new SerialisationException("Failed to deserialise the Type from TypeValue Object", e);
        }
      }
      lastDelimiter = i + 1;
      break;
    }
  }
  if (bytes.length > lastDelimiter) {
    try {
      typeValue.setValue(new String(ByteArrayEscapeUtils.unEscape(bytes, lastDelimiter, bytes.length), CommonConstants.UTF_8));
    } catch (final UnsupportedEncodingException e) {
      throw new SerialisationException("Failed to deserialise the Value from TypeValue Object", e);
    }
  }
  return typeValue;
}
uk.gov.gchq.gaffer.typesTypeValuesetType

Popular methods of TypeValue

  • <init>
  • getType
  • getValue
  • setValue
  • compareTo
  • equals
  • hashCode

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • putExtra (Intent)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now