类java.nio.charset.Charset源码实例Demo

下面列出了怎么用java.nio.charset.Charset的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Tomcat7.0.67   文件: TestUtf8.java
@Test
public void testJvmDecoder() {
    CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder();
    int testCount = 0;
    try {
        for (Utf8TestCase testCase : TEST_CASES) {
            doTest(decoder, testCase, testCase.flagsJvm);
            testCount++;
        }
    } finally {
        System.err.println("Workarounds added to " + workAroundCount +
                " tests to account for known JVM bugs");
        if (testCount < TEST_CASES.size()) {
            System.err.println("Executed " + testCount + " of " +
                    TEST_CASES.size() + " UTF-8 tests before " +
                    "encountering a failure");
        }
    }
}
 
源代码2 项目: astor   文件: DocumentTest.java
@Test
public void testShiftJisRoundtrip() throws Exception {
    String input =
            "<html>"
                    +   "<head>"
                    +     "<meta http-equiv=\"content-type\" content=\"text/html; charset=Shift_JIS\" />"
                    +   "</head>"
                    +   "<body>"
                    +     "before&nbsp;after"
                    +   "</body>"
                    + "</html>";
    InputStream is = new ByteArrayInputStream(input.getBytes(Charset.forName("ASCII")));

    Document doc = Jsoup.parse(is, null, "http://example.com");
    doc.outputSettings().escapeMode(Entities.EscapeMode.xhtml);

    String output = new String(doc.html().getBytes(doc.outputSettings().charset()), doc.outputSettings().charset());

    assertFalse("Should not have contained a '?'.", output.contains("?"));
    assertTrue("Should have contained a '&#xa0;' or a '&nbsp;'.",
            output.contains("&#xa0;") || output.contains("&nbsp;"));
}
 
源代码3 项目: flink-learning   文件: NiFiSourceMain.java
public static void main(String[] args) throws Exception {
    StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

    SiteToSiteClientConfig clientConfig = new SiteToSiteClient.Builder()
            .url("http://localhost:8080/nifi")
            .portName("Data for Flink")
            .requestBatchCount(5)
            .buildConfig();

    SourceFunction<NiFiDataPacket> nifiSource = new NiFiSource(clientConfig);
    DataStream<NiFiDataPacket> streamSource = env.addSource(nifiSource).setParallelism(2);

    DataStream<String> dataStream = streamSource.map(new MapFunction<NiFiDataPacket, String>() {
        @Override
        public String map(NiFiDataPacket value) throws Exception {
            return new String(value.getContent(), Charset.defaultCharset());
        }
    });

    dataStream.print();
    env.execute();
}
 
源代码4 项目: incubator-atlas   文件: ClassType.java
@Override
public void updateSignatureHash(MessageDigest digester, Object val) throws AtlasException {
    if( !(val instanceof  ITypedReferenceableInstance)) {
        throw new IllegalArgumentException("Unexpected value type " + val.getClass().getSimpleName() + ". Expected instance of ITypedStruct");
    }
    digester.update(getName().getBytes(Charset.forName("UTF-8")));

    if(fieldMapping.fields != null && val != null) {
        IReferenceableInstance typedValue = (IReferenceableInstance) val;
        if(fieldMapping.fields.values() != null) {
            for (AttributeInfo aInfo : fieldMapping.fields.values()) {
                Object attrVal = typedValue.get(aInfo.name);
                if (attrVal != null) {
                    aInfo.dataType().updateSignatureHash(digester, attrVal);
                }
            }
        }
    }
}
 
源代码5 项目: ground-android   文件: GeoJsonParser.java
/**
 * Returns the immutable list of tiles specified in {@param geojson} that intersect {@param
 * bounds}.
 */
public ImmutableList<Tile> intersectingTiles(LatLngBounds bounds, File file) {
  try {
    String fileContents = FileUtils.readFileToString(file, Charset.forName(JSON_SOURCE_CHARSET));
    // TODO: Separate parsing and intersection checks, make asyc (single, completable).
    JSONObject geoJson = new JSONObject(fileContents);
    // TODO: Make features constant.
    JSONArray features = geoJson.getJSONArray(FEATURES_KEY);

    return stream(toArrayList(features))
        .map(GeoJsonTile::new)
        .filter(tile -> tile.boundsIntersect(bounds))
        .map(this::jsonToTile)
        .collect(toImmutableList());

  } catch (JSONException | IOException e) {
    Log.e(TAG, "Unable to parse JSON", e);
  }

  return ImmutableList.of();
}
 
源代码6 项目: deeplearning4j   文件: FileRecordReader.java
@Override
public List<Record> loadFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException {
    List<Record> out = new ArrayList<>();

    for (RecordMetaData meta : recordMetaDatas) {
        URI uri = meta.getURI();

        List<Writable> list;
        try(InputStream s = streamCreatorFn.apply(uri)) {
            list = loadFromStream(uri, s, Charset.forName(charset));
        } catch (IOException e){
            throw new RuntimeException("Error reading from stream for URI: " + uri);
        }

        out.add(new org.datavec.api.records.impl.Record(list, meta));
    }

    return out;
}
 
源代码7 项目: joyqueue   文件: ArchiveSerializer.java
/**
 * 计算消费日志占用的长度
 * <br>
 * (byte[]:messageId, int:brokerId, byte[16]:clientIP, long:consumeTime, String:app(变长), )
 *
 * @param consumeLog
 * @return
 */
private static int consumeLogSize(ConsumeLog consumeLog) {
    int size = 0;
    // messageId
    size += consumeLog.getBytesMessageId().length;
    // brokerId
    size += 4;
    // clientIp
    size += 16;
    // consumeTime
    size += 8;
    // app长度
    size += 2;
    // app
    size += consumeLog.getApp().getBytes(Charset.forName("utf-8")).length;
    return size;
}
 
@Test
public void test_load_plugins_folder_contains_jar_file() throws Exception {
    final File pluginsFolder = temporaryFolder.newFolder("extension");
    final File pluginFolder = temporaryFolder.newFolder("extension", "plugin1");
    final File file = new File(pluginFolder, "extension.jar");
    FileUtils.writeStringToFile(pluginFolder.toPath().resolve("hivemq-extension.xml").toFile(),
            validPluginXML1,
            Charset.defaultCharset());
    final JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class).
            addAsServiceProviderAndClasses(ExtensionMain.class, TestExtensionMainImpl.class);

    javaArchive.as(ZipExporter.class).exportTo(file);

    when(classServiceLoader.load(eq(ExtensionMain.class), any(ClassLoader.class))).thenReturn(new ArrayList<>());

    pluginLoader.loadPlugins(pluginsFolder.toPath(), false, ExtensionMain.class);

    //Let's verify that the extension was loaded
    verify(classServiceLoader).load(any(Class.class), any(ClassLoader.class));
}
 
@Override
public void setContentType(String type) {
    if (isCommitted()) {
        return;
    }
    if (hasWriter()) {
        return;
    }
    if (null == type) {
        contentType = null;
        return;
    }
    MediaType mediaType = MediaType.parse(type);
    Optional<Charset> charset = mediaType.charset();
    if (charset.isPresent()) {
        setCharacterEncoding(charset.get().name());
    }
    contentType = mediaType.type() + '/' + mediaType.subtype();
}
 
源代码10 项目: cyberduck   文件: DefaultUploadFeatureTest.java
@Test
public void testUpload() throws Exception {
    final DefaultUploadFeature<VersionId> m = new DefaultUploadFeature<VersionId>(new GoogleStorageWriteFeature(session));
    final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume));
    final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
    final Local local = new Local(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString());
    final String random = new RandomStringGenerator.Builder().build().generate(1000);
    final OutputStream out = local.getOutputStream(false);
    IOUtils.write(random, out, Charset.defaultCharset());
    out.close();
    final TransferStatus status = new TransferStatus();
    status.setLength(random.getBytes().length);
    m.upload(test, local, new BandwidthThrottle(BandwidthThrottle.UNLIMITED),
        new DisabledStreamListener(), status, new DisabledLoginCallback());
    assertTrue(new GoogleStorageFindFeature(session).find(test));
    final PathAttributes attributes = new GoogleStorageListService(session).list(container,
        new DisabledListProgressListener()).get(test).attributes();
    assertEquals(random.getBytes().length, attributes.getSize());
    new GoogleStorageDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    local.delete();
}
 
源代码11 项目: nifi   文件: PutCassandraQL.java
/**
 * Determines the CQL statement that should be executed for the given FlowFile
 *
 * @param session  the session that can be used to access the given FlowFile
 * @param flowFile the FlowFile whose CQL statement should be executed
 * @return the CQL that is associated with the given FlowFile
 */

private String getCQL(final ProcessSession session, final FlowFile flowFile, final Charset charset) {
    // Read the CQL from the FlowFile's content
    final byte[] buffer = new byte[(int) flowFile.getSize()];
    session.read(flowFile, new InputStreamCallback() {
        @Override
        public void process(final InputStream in) throws IOException {
            StreamUtils.fillBuffer(in, buffer);
        }
    });

    // Create the PreparedStatement string to use for this FlowFile.
    return new String(buffer, charset);
}
 
源代码12 项目: teiid-spring-boot   文件: TeiidRSProvider.java
public ResponseEntity<InputStreamResource> executeQuery(final String sql, boolean json, final boolean passthroughAuth)
        throws SQLException {
    Connection conn = null;
    try {
        conn = getConnection();
        Statement statement = conn.createStatement();
        final boolean hasResultSet = statement.execute(sql);
        Object result = null;
        if (hasResultSet) {
            ResultSet rs = statement.getResultSet();
            if (rs.next()) {
                result = rs.getObject(1);
            } else {
                throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"Only result producing procedures are allowed");
            }
        }
        InputStream is = handleResult(Charset.defaultCharset().name(), result);
        InputStreamResource inputStreamResource = new InputStreamResource(is);
        HttpHeaders httpHeaders = new HttpHeaders();
        return new ResponseEntity<InputStreamResource>(inputStreamResource, httpHeaders, HttpStatus.OK);
    } finally {
        try {
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
        }
    }
}
 
源代码13 项目: hottub   文件: StreamTest.java
public void testConstructException() {
    try (Stream<String> s = Files.lines(testFolder.resolve("notExist"), Charset.forName("UTF-8"))) {
        s.forEach(l -> fail("File is not even exist!"));
    } catch (IOException ioe) {
        assertTrue(ioe instanceof NoSuchFileException);
    }
}
 
源代码14 项目: msf4j   文件: EchoService.java
@POST
@Path("fileecho")
@Consumes("text/plain")
@Produces("text/plain")
public String fileWrite(String body) throws InterruptedException, IOException {
    String returnStr = "";
    java.nio.file.Path tempfile = Files.createTempFile(UUID.randomUUID().toString(), ".tmp");
    Files.write(tempfile, body.getBytes(Charset.defaultCharset()),
                StandardOpenOption.CREATE,
                StandardOpenOption.TRUNCATE_EXISTING);
    returnStr = new String(Files.readAllBytes(tempfile), Charset.defaultCharset());
    Files.delete(tempfile);
    return returnStr;
}
 
源代码15 项目: OpenYOLO-Android   文件: LoginViewModel.java
private String base64Sha256Hash(byte[] data) {
    try {
        MessageDigest digest = MessageDigest.getInstance("SHA-256");
        byte[] sha256Bytes = digest.digest(data);
        return new String(
                Base64.encode(sha256Bytes, Base64.NO_WRAP | Base64.URL_SAFE),
                Charset.forName("UTF-8"));
    } catch (NoSuchAlgorithmException e) {
        throw new IllegalStateException("SHA-256 not supported on this platform!");
    }
}
 
源代码16 项目: netty4.0.27Learn   文件: HttpRequestEncoderTest.java
@Test
public void testQueryStringPath() throws Exception {
    HttpRequestEncoder encoder = new HttpRequestEncoder();
    ByteBuf buffer = Unpooled.buffer(64);
    encoder.encodeInitialLine(buffer, new DefaultHttpRequest(HttpVersion.HTTP_1_1,
            HttpMethod.GET, "/?url=http://example.com"));
    String req = buffer.toString(Charset.forName("US-ASCII"));
    assertEquals("GET /?url=http://example.com HTTP/1.1\r\n", req);
}
 
源代码17 项目: ReactiveLab   文件: ClientServer.java
public static Observable<String> createRequest(String host, int port) {

        /**
         * Creates an HTTP client bound to the provided host and port.
         */
        return RxNetty.createHttpClient(host, port)
                /* Submit an HTTP GET request with uri "/hello" */
                .submit(HttpClientRequest.createGet("/hello"))
                /* Print the HTTP initial line and headers. Return the content.*/
                .flatMap(response -> {
                    /**
                     * Printing the HTTP initial line.
                     */
                    System.out.println(response.getHttpVersion().text() + ' ' + response.getStatus().code()
                                       + ' ' + response.getStatus().reasonPhrase());
                    /**
                     * Printing HTTP headers.
                     */
                    for (Map.Entry<String, String> header : response.getHeaders().entries()) {
                        System.out.println(header.getKey() + ": " + header.getValue());
                    }

                    // Line break after the headers.
                    System.out.println();

                    return response.getContent();
                })
                /* Convert the ByteBuf for each content chunk into a string. */
                .map(byteBuf -> byteBuf.toString(Charset.defaultCharset()));

    }
 
源代码18 项目: openjdk-8   文件: ToolBox.java
public static void compareLines(Path path, List<String> strings,
        String encoding, boolean trim)
        throws FileNotFoundException, IOException, ResourcesNotEqualException {
    Charset charset = encoding != null ?
            Charset.forName(encoding) :
            defaultCharset;
    List<String> list = Files.readAllLines(path, charset);
    compareLines(list, strings, trim);
}
 
源代码19 项目: Asqatasun   文件: HttpRequestHandler.java
public String getHttpContent (String url) throws URISyntaxException, UnknownHostException, IOException, IllegalCharsetNameException {
    if (StringUtils.isEmpty(url)){
        return "";
    }
    String encodedUrl = getEncodedUrl(url);
    CloseableHttpClient httpClient = getHttpClient(encodedUrl);
    HttpGet get = new HttpGet(encodedUrl);
    try {
        LOGGER.debug("executing request to retrieve content on " + get.getURI());
        HttpResponse response = httpClient.execute(get);
        LOGGER.debug("received " + response.getStatusLine().getStatusCode() + " from get request");
        if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
            LOGGER.debug("status == HttpStatus.SC_OK " );
            return EntityUtils.toString(response.getEntity(), Charset.defaultCharset());
        } else {
            LOGGER.debug("status != HttpStatus.SC_OK " );
            return "";
        }
        
    } catch (NullPointerException ioe) {
        LOGGER.debug("NullPointerException");
        return "";
    } finally {
        // When HttpClient instance is no longer needed,
        // shut down the connection manager to ensure
        // immediate deallocation of all system resources
        get.releaseConnection();
        LOGGER.debug("finally");
        httpClient.close();
    }
}
 
源代码20 项目: che   文件: CheBootstrapTest.java
private void writePropertiesFile(File parent, String name, Properties properties)
    throws IOException {
  File propertiesFile = new File(parent, name);
  try (Writer writer = Files.newWriter(propertiesFile, Charset.forName("UTF-8"))) {
    properties.store(writer, null);
  }
}
 
源代码21 项目: vespa   文件: ErrorCodesTest.java
/**
 * Always meant to be run against HEAD.
 */
@Test
public void errorCodesMatchCppDefinitions() throws Exception {
    final NamedErrorCodes codes = new NamedErrorCodes();
    enumerateAllDocumentProtocolErrorCodes(codes);

    final String javaGoldenFile = TestFileUtil.getPath("HEAD-java-golden-error-codes.txt");
    final String javaGoldenData = codes.toSortedKeyValueString();
    TestFileUtil.writeToFile(javaGoldenFile, javaGoldenData);

    final String cppGoldenFile = TestFileUtil.getPath("HEAD-cpp-golden-error-codes.txt");
    final String cppGoldenData = new String(TestFileUtil.readFile(cppGoldenFile), Charset.forName("UTF-8"));
    assertEquals(javaGoldenData, cppGoldenData);
}
 
源代码22 项目: scheduling   文件: TestUnauthorizedScripts.java
@BeforeClass
public static void before() throws Throwable {
    // initialize the scheduler & rm with a custom authorized script folder

    scriptsFolder = folder.newFolder("scripts");
    File schedulerConfigFile = generateConfigFile(originalSchedulerConfigFile.toURI(), "schedulerConfig");
    File rmConfigFile = generateConfigFile(originalRMConfigFile.toURI(), "rmConfig");

    // create authorized and unauthorized scripts
    String tempFolderPathEscaped = folder.getRoot().getAbsolutePath().replace("\\", "\\\\");
    authorizedForkScriptContent = "new File('" + tempFolderPathEscaped + "','fork_auth.out').write('ok')";
    authorizedCleanScriptContent = "new File('" + tempFolderPathEscaped + "','clean_auth.out').write('ok')";
    authorizedSelectionScriptContent = "new File('" + tempFolderPathEscaped +
                                       "','selection_auth.out').write('ok'); selected=true";

    File forkScript = new File(scriptsFolder, "forkScript");
    FileUtils.write(forkScript, authorizedForkScriptContent, Charset.defaultCharset(), false);
    File cleanScript = new File(scriptsFolder, "cleanScript");
    FileUtils.write(cleanScript, authorizedCleanScriptContent, Charset.defaultCharset(), false);
    File selectionScript = new File(scriptsFolder, "selectionScript");
    FileUtils.write(selectionScript, authorizedSelectionScriptContent, Charset.defaultCharset(), false);

    unauthorizedForkScriptContent = "new File('" + tempFolderPathEscaped + "','fork.out').write('ko')";
    unauthorizedCleanScriptContent = "new File('" + tempFolderPathEscaped + "','clean.out').write('ko')";
    unauthorizedSelectionScriptContent = "new File('" + tempFolderPathEscaped +
                                         "','selection.out').write('ko'); selected=true";

    // start the configured scheduler
    schedulerHelper = new SchedulerTHelper(true,
                                           schedulerConfigFile.getAbsolutePath(),
                                           rmConfigFile.getAbsolutePath(),
                                           null);
}
 
源代码23 项目: swellrt   文件: AccountServiceTest.java
protected ServletInputStream asServletInputStream(final String data) {
  return new ServletInputStream() {

    ByteArrayInputStream byteInputStream =
        new ByteArrayInputStream(data.getBytes(Charset.forName("UTF-8")));

    int b;

    @Override
    public boolean isFinished() {
      return b == -1;
    }

    @Override
    public boolean isReady() {
      return true;
    }

    @Override
    public void setReadListener(ReadListener readListener) {
    }

    @Override
    public int read() throws IOException {
      this.b = byteInputStream.read();
      return b;
    }

  };
}
 
源代码24 项目: log4j2-elasticsearch   文件: AdminOperationsTest.java
@Test
public void passesIndexTemplateToClient() {

    //given
    HCHttp factory = Mockito.spy(HCHttpTest.createDefaultHttpObjectFactoryBuilder().build());

    HttpClient httpClient = mockedHttpClient(factory);
    AtomicReference<ByteBuf> argCaptor = new AtomicReference<>();
    mockedResult(httpClient, true, argCaptor);

    IndexTemplate indexTemplate = spy(IndexTemplate.newBuilder()
            .withPath("classpath:indexTemplate.json")
            .withName("testName")
            .build());

    String expectedPayload = indexTemplate.getSource();

    // when
    factory.execute(indexTemplate);

    // then
    ArgumentCaptor<IndexTemplateRequest> requestArgumentCaptor = ArgumentCaptor.forClass(IndexTemplateRequest.class);
    verify(httpClient).execute(requestArgumentCaptor.capture(), any());

    assertEquals(argCaptor.get().toString(Charset.forName("UTF-8")), expectedPayload);

}
 
源代码25 项目: jdk8u-dev-jdk   文件: ISO2022_CN_CNS.java
public Encoder(Charset cs)
{
    super(cs);
    SODesig = "$)G";
    SS2Desig = "$*H";
    SS3Desig = "$+I";

    try {
        Charset cset = Charset.forName("EUC_TW"); // CNS11643
        ISOEncoder = cset.newEncoder();
    } catch (Exception e) { }
}
 
private static String checkConvertMime2Java(String xml) {
    final String jName = Encodings.convertMime2JavaEncoding(xml);
    final String jCharsetName;
    try {
        jCharsetName = Charset.forName(jName).name();
    } catch (Exception x) {
        throw new Error("Unrecognized charset returned by Encodings.convertMime2JavaEncoding(\""+xml+"\")", x);
    }
    System.out.println("Encodings.convertMime2JavaEncoding(\""+xml+"\") = \""+jName+"\" ("+jCharsetName+")");
    return jName;
}
 
源代码27 项目: nifi   文件: TestGetSchema.java
@Test
@Ignore("Does not work on windows")
public void testSchemaFromFileSystem() throws IOException {
    File schemaFile = temp.newFile("schema.avsc");
    FileOutputStream out = new FileOutputStream(schemaFile);
    out.write(bytesFor(SCHEMA.toString(), Charset.forName("utf8")));
    out.close();

    Schema schema = AbstractKiteProcessor.getSchema(
            schemaFile.toString(), DefaultConfiguration.get());

    Assert.assertEquals("Schema from file should match", SCHEMA, schema);
}
 
源代码28 项目: j2objc   文件: ChannelsTest.java
public void testNewWriterWritableByteChannelString() throws IOException {
    this.fouts = new FileOutputStream(tmpFile);
    WritableByteChannel wbChannel = Channels.newChannel(this.fouts);
    Writer testWriter = Channels.newWriter(wbChannel, CODE_SET); //$NON-NLS-1$
    Writer testWriter_s = Channels.newWriter(wbChannel, Charset.forName(
            CODE_SET).newEncoder(), //$NON-NLS-1$
            -1);

    String writebuf = ""; //$NON-NLS-1$
    for (int val = 0; val < this.writebufSize / 2; val++) {
        writebuf = writebuf + ((char) (val + 64));
    }
    byte[] bit = new byte[1];
    bit[0] = 80;
    this.fouts.write(bit);
    this.assertFileSizeSame(tmpFile, 1);

    // writer continues to write after '1',what the fouts write
    testWriter.write(writebuf);
    testWriter.flush();
    this.assertFileSizeSame(tmpFile, this.writebufSize / 2 + 1);
    // testwriter_s does not know if testwrite writes
    testWriter_s.write(writebuf);
    testWriter.flush();
    this.assertFileSizeSame(tmpFile, this.writebufSize / 2 + 1);
    // testwriter_s even does not know if himself writes?
    testWriter_s.write(writebuf);
    testWriter.flush();
    this.assertFileSizeSame(tmpFile, this.writebufSize / 2 + 1);

    // close the fouts, no longer writable for testWriter
    for (int val = 0; val < this.writebufSize; val++) {
        writebuf = writebuf + ((char) (val + 64));
    }
    this.fouts.close();
    testWriter_s.write(writebuf);
    testWriter.flush();
    this.assertFileSizeSame(tmpFile, this.writebufSize / 2 + 1);
}
 
源代码29 项目: osmdroid   文件: DefaultShapeMetaSetter.java
@Override
public void set(DbfRecord metadata, Polygon polygon) throws ParseException {
    if (metadata != null) {
        metadata.setStringCharset(Charset.defaultCharset());
        polygon.setSnippet(metadata.toMap().toString());
        polygon.setTitle(getSensibleTitle(polygon.getSnippet()));
    }
    final BoundingBox boundingBox = polygon.getBounds();
    polygon.setSubDescription(boundingBox.toString());
}
 
源代码30 项目: kafka-statsd-reporter   文件: StatsdReporter.java
private void flush() {
	try {
		int sizeOfBuffer = sendBuffer.position();
		if (sizeOfBuffer <= 0) {
			// empty buffer
			return;
		}

		// send and reset the buffer
		sendBuffer.flip();
		int nbSentBytes = channel.send(sendBuffer, address);
		LOG.debug("Send entirely stat :" + new String(sendBuffer.array(), Charset.forName("UTF-8")) + " to host "
				+ address.getHostName() + " : " + address.getPort());
		if (sizeOfBuffer != nbSentBytes) {
			LOG.error("Could not send entirely stat (" + sendBuffer.toString() + ") : "
					+  new String(sendBuffer.array(), Charset.forName("UTF-8")) + " to host "
					+ address.getHostName() + " : " + address.getPort() + ". Only sent " + nbSentBytes
					+ " out of " + sizeOfBuffer);
		}
		sendBuffer.limit(sendBuffer.capacity());
		sendBuffer.rewind();
	} catch (IOException e) {
		LOG.error("Could not send entirely stat (" + sendBuffer.toString() + ") : "
				+  new String(sendBuffer.array(), Charset.forName("UTF-8")) + " to host "
				+ address.getHostName() + " : "	+ address.getPort(), e);
	}
}