Skip to content

Limitation on byte size (inputstream) #34

Description

@qpqqq

Hello,
I am trying to pass an inputstream to Param() but i am always getting : "expected 1024 bytes but received 8192".
Here how i am trying to use:

try (InputStream inputStream = fileData.getBody(InputStream.class)) {
String documentId = documentService.compressDocument( owner, titleString, new Origin(OriginType.WIDERSPRUCH, caseId), fileData.getFileName(), fileData.getMediaType().getType() + "/" + fileData.getMediaType().getSubtype(), inputStream, documentType);
return Response.ok(new Success(documentId)).build();
}
Here i am receiving the file as inputPart then i am converting it to inputstream, then i am passing these parameters to convert function like the following : InputStream resultStream = convertService.convert("pdf", "compress", inputStream, filename);

Activity

  1. Ivandopalas commented on Apr 7, 2025

    @Ivandopalas

    same problem here
    ConvertApi.convert("doc", "pdf", new Param("File", inputStream, originalFileName)).get();
    causes
    java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.net.ProtocolException: expected 7903 bytes but received 8192

  2. kmozsi commented on Jun 12, 2025

    @kmozsi
    Contributor

    Attempt to fix this issue in this PR. I couldn't reproduce the exception but I think the mismatch comes from inputStream.available() which only returns an approximate size. Could you share the full stack trace by any chance? That would help a lot. Otherwise we will release a new version with this fix soon.

  3. self-assigned this
    on Jun 12, 2025
  4. kmozsi commented on Jun 18, 2025

    @kmozsi
    Contributor

    This should now be fixed in v2.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions